* [PATCH -v2] Bluetooth: Fix wrong set of skb fragments
@ 2012-05-15 16:22 Gustavo Padovan
2012-05-16 7:47 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Padovan @ 2012-05-15 16:22 UTC (permalink / raw)
To: linux-bluetooth
If alloc() fails we let the frags linked list with garbage value(the err
ptr value) in its last element.
Reported-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
---
net/bluetooth/l2cap_core.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 869beb3..8a84a18 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1836,13 +1836,17 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
/* Continuation fragments (no L2CAP header) */
frag = &skb_shinfo(skb)->frag_list;
while (len) {
+ struct sk_buff *tmp;
+
count = min_t(unsigned int, conn->mtu, len);
- *frag = chan->ops->alloc_skb(chan, count,
- msg->msg_flags & MSG_DONTWAIT);
+ tmp = chan->ops->alloc_skb(chan, count,
+ msg->msg_flags & MSG_DONTWAIT);
+ if (IS_ERR(tmp))
+ return PTR_ERR(tmp);
+
+ *frag = tmp;
- if (IS_ERR(*frag))
- return PTR_ERR(*frag);
if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count))
return -EFAULT;
--
1.7.10.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -v2] Bluetooth: Fix wrong set of skb fragments
2012-05-15 16:22 [PATCH -v2] Bluetooth: Fix wrong set of skb fragments Gustavo Padovan
@ 2012-05-16 7:47 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-05-16 7:47 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth
Hi Gustavo,
On Tue, May 15, 2012, Gustavo Padovan wrote:
> If alloc() fails we let the frags linked list with garbage value(the err
> ptr value) in its last element.
>
> Reported-by: Mat Martineau <mathewm@codeaurora.org>
> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
> ---
> net/bluetooth/l2cap_core.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-16 7:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 16:22 [PATCH -v2] Bluetooth: Fix wrong set of skb fragments Gustavo Padovan
2012-05-16 7:47 ` Johan Hedberg
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).