Skip to content

Commit f119ff8

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: garmin_gps: fix memory leak on probe errors
commit 74d471b598444b7f2d964930f7234779c80960a0 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>
1 parent 8b36209 commit f119ff8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/usb/serial/garmin_gps.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,12 @@ static int garmin_port_probe(struct usb_serial_port *port)
14141414
usb_set_serial_port_data(port, garmin_data_p);
14151415

14161416
status = garmin_init_session(port);
1417+
if (status)
1418+
goto err_free;
1419+
1420+
return 0;
1421+
err_free:
1422+
kfree(garmin_data_p);
14171423

14181424
return status;
14191425
}

0 commit comments

Comments
 (0)