Skip to content

Commit

Permalink
USB: serial: garmin_gps: fix memory leak on probe errors
Browse files Browse the repository at this point in the history
commit 74d471b upstream.

Make sure to free the port private data before returning after a failed
probe attempt.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Nov 21, 2017
1 parent 8b36209 commit f119ff8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/usb/serial/garmin_gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,12 @@ static int garmin_port_probe(struct usb_serial_port *port)
usb_set_serial_port_data(port, garmin_data_p);

status = garmin_init_session(port);
if (status)
goto err_free;

return 0;
err_free:
kfree(garmin_data_p);

return status;
}
Expand Down

0 comments on commit f119ff8

Please sign in to comment.