]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.4.17/usb-opticon-fix-memory-leak-in-error-path.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.17 / usb-opticon-fix-memory-leak-in-error-path.patch
CommitLineData
0e6078b8
GKH
1From acbf0e5263de563e25f7c104868e4490b9e72b13 Mon Sep 17 00:00:00 2001
2From: Johan Hovold <jhovold@gmail.com>
3Date: Thu, 25 Oct 2012 10:29:12 +0200
4Subject: USB: opticon: fix memory leak in error path
5
6From: Johan Hovold <jhovold@gmail.com>
7
8commit acbf0e5263de563e25f7c104868e4490b9e72b13 upstream.
9
10Fix memory leak in write error path.
11
12Signed-off-by: Johan Hovold <jhovold@gmail.com>
13Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14
15---
16 drivers/usb/serial/opticon.c | 4 +++-
17 1 file changed, 3 insertions(+), 1 deletion(-)
18
19--- a/drivers/usb/serial/opticon.c
20+++ b/drivers/usb/serial/opticon.c
21@@ -297,7 +297,7 @@ static int opticon_write(struct tty_stru
22 if (!dr) {
23 dev_err(&port->dev, "out of memory\n");
24 count = -ENOMEM;
25- goto error;
26+ goto error_no_dr;
27 }
28
29 dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
30@@ -327,6 +327,8 @@ static int opticon_write(struct tty_stru
31
32 return count;
33 error:
34+ kfree(dr);
35+error_no_dr:
36 usb_free_urb(urb);
37 error_no_urb:
38 kfree(buffer);