* [PATCH] bluetooth: Fix failure to release lock in read_index_list() when mem alloc fails.
@ 2011-01-13 23:18 Jesper Juhl
2011-01-19 3:38 ` Gustavo F. Padovan
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-01-13 23:18 UTC (permalink / raw)
To: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, David S. Miller,
Gustavo F. Padovan, Marcel Holtmann
If alloc_skb() fails in read_index_list() we'll return -ENOMEM without
releasing 'hci_dev_list_lock'.
Signed-off-by: Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org>
---
mgmt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f827fd9..ace8726 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -111,8 +111,10 @@ static int read_index_list(struct sock *sk)
body_len = sizeof(*ev) + sizeof(*rp) + (2 * count);
skb = alloc_skb(sizeof(*hdr) + body_len, GFP_ATOMIC);
- if (!skb)
+ if (!skb) {
+ read_unlock(&hci_dev_list_lock);
return -ENOMEM;
+ }
hdr = (void *) skb_put(skb, sizeof(*hdr));
hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE);
--
Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bluetooth: Fix failure to release lock in read_index_list() when mem alloc fails.
2011-01-13 23:18 [PATCH] bluetooth: Fix failure to release lock in read_index_list() when mem alloc fails Jesper Juhl
@ 2011-01-19 3:38 ` Gustavo F. Padovan
0 siblings, 0 replies; 2+ messages in thread
From: Gustavo F. Padovan @ 2011-01-19 3:38 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-bluetooth, netdev, linux-kernel, David S. Miller,
Marcel Holtmann
Hi Jesper,
* Jesper Juhl <jj@chaosbits.net> [2011-01-14 00:18:49 +0100]:
> If alloc_skb() fails in read_index_list() we'll return -ENOMEM without
> releasing 'hci_dev_list_lock'.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> mgmt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Patch has been applied. Thanks.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-19 3:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 23:18 [PATCH] bluetooth: Fix failure to release lock in read_index_list() when mem alloc fails Jesper Juhl
2011-01-19 3:38 ` Gustavo F. Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).