提交 fbe00700 编写于 作者: G Gustavo Padovan 提交者: Gustavo Padovan

Bluetooth: Fix wrong set of skb fragments

If alloc() fails we let the frags linked list with garbage value (the
err ptr value) in its last element.
Reported-by: NMat Martineau <mathewm@codeaurora.org>
Signed-off-by: NGustavo Padovan <gustavo@padovan.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 08e6d907
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册