From: Alexey Khoroshilov Date: Tue, 8 Oct 2013 20:50:16 +0000 (+0400) Subject: staging: gdm7240: fix memory leak on failure path X-Git-Tag: v3.13-rc1~170^2~385 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=47052577bcb941da36a991fea3dadc0d3b14c741;p=kernel%2Fkernel-generic.git staging: gdm7240: fix memory leak on failure path 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c index 3c89eaa..6216367 100644 --- a/drivers/staging/gdm724x/gdm_mux.c +++ b/drivers/staging/gdm724x/gdm_mux.c @@ -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; @@ -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);