mirror of https://gitee.com/openkylin/linux.git
usb: usbtmc: Fix memory leak in usbtmc_ioctl_request
Kernel memory is allocated twice in new function
usbtmc_ioctl_request and creates a memory leak.
This fix removes the superfluous kmalloc().
Signed-off-by: Guido Kiener <guido.kiener@rohde-schwarz.com>
Fixes: 658f24f452
("usb: usbtmc: Add ioctl for generic requests on control")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4d2a863fe9
commit
100f2cdead
|
@ -1895,10 +1895,6 @@ static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
|
||||||
if (res)
|
if (res)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
buffer = kmalloc(request.req.wLength, GFP_KERNEL);
|
|
||||||
if (!buffer)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
if (request.req.wLength > USBTMC_BUFSIZE)
|
if (request.req.wLength > USBTMC_BUFSIZE)
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue