Thread (1 message) 1 message, 1 author, 2016-01-04

Fwd: [PATCH stable-3.14] usb: gadget: f_ncm: fix skb_clone memleak on error

From: pavi1729 <hidden>
Date: 2016-01-04 06:16:07
Subsystem: the rest, usb subsystem · Maintainers: Linus Torvalds, Greg Kroah-Hartman

Possibly related (same subject, not in this thread)

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

Signed-off-by: Pavitrakumar Managutte <redacted>
---
 drivers/usb/gadget/f_ncm.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c
index a9499fd..6227fa2 100644
--- a/drivers/usb/gadget/f_ncm.c
+++ b/drivers/usb/gadget/f_ncm.c
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help