Skip to content

Commit

Permalink
staging: gdm7240: fix memory leak on failure path
Browse files Browse the repository at this point in the history
init_usb() may fail after some of mux_rxes already allocated.
So we need to release them on the failure path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Oct 11, 2013
1 parent a4d8c83 commit 4705257
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/gdm724x/gdm_mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static int gdm_mux_probe(struct usb_interface *intf, const struct usb_device_id

ret = init_usb(mux_dev);
if (ret)
goto err_free_tty;
goto err_free_usb;

tty_dev->priv_dev = (void *)mux_dev;
tty_dev->send_func = gdm_mux_send;
Expand All @@ -565,8 +565,8 @@ static int gdm_mux_probe(struct usb_interface *intf, const struct usb_device_id

err_unregister_tty:
unregister_lte_tty_device(tty_dev);
err_free_usb:
release_usb(mux_dev);
err_free_tty:
kfree(tty_dev);
err_free_mux:
kfree(mux_dev);
Expand Down

0 comments on commit 4705257

Please sign in to comment.