]> git.itanic.dy.fi Git - linux-stable/commitdiff
USB: serial: garmin_gps: fix memory leak on failed URB submit
authorJohan Hovold <johan@kernel.org>
Tue, 3 Jan 2017 15:39:41 +0000 (16:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:22:46 +0000 (11:22 +0100)
commit c4ac4496e835b78a45dfbf74f6173932217e4116 upstream.

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")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/garmin_gps.c

index db591d19d416d92913b1be1a66b697dab8e5a56e..37d0e8cc7af6b608d2a79f815c06b90ee5425718 100644 (file)
@@ -1044,6 +1044,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