aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d15bf676c350..7ea5489e7977 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -29,7 +29,7 @@
29#include <net/bluetooth/hci_core.h> 29#include <net/bluetooth/hci_core.h>
30#include <net/bluetooth/mgmt.h> 30#include <net/bluetooth/mgmt.h>
31 31
32static void cmd_status(struct sock *sk, u16 cmd, u8 status) 32static int cmd_status(struct sock *sk, u16 cmd, u8 status)
33{ 33{
34 struct sk_buff *skb; 34 struct sk_buff *skb;
35 struct mgmt_hdr *hdr; 35 struct mgmt_hdr *hdr;
@@ -39,7 +39,7 @@ static void cmd_status(struct sock *sk, u16 cmd, u8 status)
39 39
40 skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_ATOMIC); 40 skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_ATOMIC);
41 if (!skb) 41 if (!skb)
42 return; 42 return -ENOMEM;
43 43
44 hdr = (void *) skb_put(skb, sizeof(*hdr)); 44 hdr = (void *) skb_put(skb, sizeof(*hdr));
45 45
@@ -52,6 +52,8 @@ static void cmd_status(struct sock *sk, u16 cmd, u8 status)
52 52
53 if (sock_queue_rcv_skb(sk, skb) < 0) 53 if (sock_queue_rcv_skb(sk, skb) < 0)
54 kfree_skb(skb); 54 kfree_skb(skb);
55
56 return 0;
55} 57}
56 58
57int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen) 59int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
@@ -87,10 +89,13 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
87 switch (opcode) { 89 switch (opcode) {
88 default: 90 default:
89 BT_DBG("Unknown op %u", opcode); 91 BT_DBG("Unknown op %u", opcode);
90 cmd_status(sk, opcode, 0x01); 92 err = cmd_status(sk, opcode, 0x01);
91 break; 93 break;
92 } 94 }
93 95
96 if (err < 0)
97 goto done;
98
94 err = msglen; 99 err = msglen;
95 100
96done: 101done: