summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-01-03 16:39:41 +0100
committerJohan Hovold <johan@kernel.org>2017-01-04 10:37:15 +0100
commitc4ac4496e835b78a45dfbf74f6173932217e4116 (patch)
treeb7f2f0e6c86dd3c39f095f11c36d8f503cdbef6f
parent3dca01114dcecb1cf324534cd8d75fd1306a516b (diff)
downloadlinux-c4ac4496e835b78a45dfbf74f6173932217e4116.tar.gz
linux-c4ac4496e835b78a45dfbf74f6173932217e4116.tar.bz2
linux-c4ac4496e835b78a45dfbf74f6173932217e4116.zip
USB: serial: garmin_gps: fix memory leak on failed URB submit
Make sure to free the URB transfer buffer in case submission fails (e.g. due to a disconnect). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
-rw-r--r--drivers/usb/serial/garmin_gps.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 97cabf803c2f..b2f2e87aed94 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1043,6 +1043,7 @@ static int garmin_write_bulk(struct usb_serial_port *port,
"%s - usb_submit_urb(write bulk) failed with status = %d\n",
__func__, status);
count = status;
+ kfree(buffer);
}
/* we are done with this urb, so let the host driver