Skip to contentSkip to conversation

usb: gadget: f_ncm: fix skb_clone memleak on error

PATCH New pavi1729 2 participants 3 messages Jan 4, 2016 – Jan 19, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

pavi1729

author
#1 lore raw

PATCH 1/1 usb: gadget: f_ncm: fix skb_clone memleak on error

Fixed skb_clone pointer memleak on error path. Since the newly cloned skb is still not added to the list, hence purge list wont free the cloned skb.
stable-3.14.y: 5d7b0fcc26

---
 drivers/usb/gadget/f_ncm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/f_ncm.c +2 -0
index a9499fd..6227fa2 100644
@@ -1066,6 +1066,8 @@ static int ncm_unwrap_ntb(struct gether *port,
                }
 
                if (!skb_pull(skb2, index)) {
+                       if(skb2 != skb)
+                               dev_kfree_skb_any(skb2);
                        ret = -EOVERFLOW;
                        goto err;
                }

--
2.1.4

#2 lore raw
In reply to a message not in the archive

correct netdev address

Quoted 6 lines · * Pavitrakumar Managutte | 2016-01-03 15:07:21 [+0530]:

Fixed skb_clone pointer memleak on error path. Since the newly cloned skb is still not added to the list, hence purge list wont free the cloned skb.
stable-3.14.y: 5d7b0fcc26

Can you check if commit 66847062a6e3 ("usb: gadget: NCM: Stop RX TCP Bursts getting dropped.") works for you? That would be [0]. If that is the case then *this* patch should be pushed stable.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=66847062a6e3

Sebastian

author
#3 lore raw

Totally missed this. Will test this today and update.

Quoted 18 lines · Sebastian Andrzej Siewior

correct netdev address

Quoted 6 lines · * Pavitrakumar Managutte | 2016-01-03 15:07:21 [+0530]:

Fixed skb_clone pointer memleak on error path. Since the newly cloned skb is still not added to the list, hence purge list wont free the cloned skb.
stable-3.14.y: 5d7b0fcc26

Can you check if commit 66847062a6e3 ("usb: gadget: NCM: Stop RX TCP Bursts getting dropped.") works for you? That would be [0]. If that is the case then *this* patch should be pushed stable.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=66847062a6e3

Sebastian