Commit b25756ec authored by Marcel Holtmann's avatar Marcel Holtmann

[Bluetooth] Fix error handling for not connected socket

This patch adds the missing fput() call for the BNEP and CMTP protocol
layers in case the user submits a not connected socket.

Noticed by Andi Kleen <ak@suse.de>
parent 1824f340
......@@ -93,8 +93,10 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
if (!nsock)
return err;
if (nsock->sk->sk_state != BT_CONNECTED)
if (nsock->sk->sk_state != BT_CONNECTED) {
fput(nsock->file);
return -EBADFD;
}
err = bnep_add_connection(&ca, nsock);
if (!err) {
......
......@@ -87,8 +87,10 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
if (!nsock)
return err;
if (nsock->sk->sk_state != BT_CONNECTED)
if (nsock->sk->sk_state != BT_CONNECTED) {
fput(nsock->file);
return -EBADFD;
}
err = cmtp_add_connection(&ca, nsock);
if (!err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment