Commit 842c7ef5 authored by Mario Schuknecht's avatar Mario Schuknecht Committed by Luis Henriques

usb: gadget: gadgetfs: Free memory allocated by memdup_user()

commit b44be246 upstream.

Commit 3b74c73f switched over to memdup_user()
in ep_write() function and removed kfree (kbuf).
memdup_user() function allocates memory which is never freed.

Fixes: 3b74c73f (usb: gadget: inode: switch over to memdup_user())
Signed-off-by: default avatarMario Schuknecht <mario.schuknecht@dresearch-fe.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - file rename: drivers/usb/gadget/legacy/inode.c ->
    drivers/usb/gadget/inode.c ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 572aaa97
...@@ -450,6 +450,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) ...@@ -450,6 +450,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
data->name, len, (int) value); data->name, len, (int) value);
free1: free1:
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
kfree (kbuf);
return value; return value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment