From: Mario Schuknecht Date: Tue, 16 Dec 2014 07:58:57 +0000 (+0100) Subject: usb: gadget: gadgetfs: Free memory allocated by memdup_user() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b44be2462dbe3e23f0aedff64de52a1e8e47a1cd;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git usb: gadget: gadgetfs: Free memory allocated by memdup_user() Commit 3b74c73f8d6f053f422e85fce955b61fb181cfe7 switched over to memdup_user() in ep_write() function and removed kfree (kbuf). memdup_user() function allocates memory which is never freed. Fixes: 3b74c73 (usb: gadget: inode: switch over to memdup_user()) Cc: # v3.15+ Signed-off-by: Mario Schuknecht Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index c744e4975d74..08048613eed6 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -449,6 +449,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) data->name, len, (int) value); free1: mutex_unlock(&data->lock); + kfree (kbuf); return value; }