usb: gadget: gadgetfs: fix an oops in ep_write()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 6 Jan 2015 10:19:21 +0000 (13:19 +0300)
committerFelipe Balbi <balbi@ti.com>
Sat, 10 Jan 2015 00:15:11 +0000 (18:15 -0600)
We try to free an ERR_PTR on this error path.

Fixes: b44be2462dbe ('usb: gadget: gadgetfs: Free memory allocated by memdup_user()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/legacy/inode.c

index 08048613eed6bcf53f928e50fc1b7054ff41d165..db49ec4c748e9469bd694645c8cfc22df7c829fa 100644 (file)
@@ -441,6 +441,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        kbuf = memdup_user(buf, len);
        if (IS_ERR(kbuf)) {
                value = PTR_ERR(kbuf);
+               kbuf = NULL;
                goto free1;
        }