aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/gdm724x
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2013-10-09 00:50:16 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-11 15:23:14 -0700
commit47052577bcb941da36a991fea3dadc0d3b14c741 (patch)
tree6911409bf9ff8c2dfae5b25b5f8e5e7b735a4812 /drivers/staging/gdm724x
parentstaging: gdm7240: alloc_mux_rx() does not need GFP_ATOMIC (diff)
downloadlinux-dev-47052577bcb941da36a991fea3dadc0d3b14c741.tar.xz
linux-dev-47052577bcb941da36a991fea3dadc0d3b14c741.zip
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 <khoroshilov@ispras.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gdm724x')
-rw-r--r--drivers/staging/gdm724x/gdm_mux.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c
index 3c89eaa4e5c7..62163673976c 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);