summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/hso.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@kernel.org>2008-08-28 00:02:37 +0200
committerJeff Garzik <jgarzik@redhat.com>2008-09-25 00:49:03 +0200
commite57b641dfafc10ce23d26cf271fd2638589fdb3f (patch)
treef5e4bf382cffe1b82cc75b3017fe014649e70029 /drivers/net/usb/hso.c
parentwan/hdlc_x25.c: fix a NULL dereference (diff)
downloadlinux-e57b641dfafc10ce23d26cf271fd2638589fdb3f.tar.xz
linux-e57b641dfafc10ce23d26cf271fd2638589fdb3f.zip
[netdrvr/usb] hso_create_bulk_serial_device(): fix a double free
hso_serial_common_free() mustn't be called if hso_serial_common_create() fails. Reported-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/usb/hso.c')
-rw-r--r--drivers/net/usb/hso.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 6e42b5a8c22b..8b2b947b6757 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2211,14 +2211,14 @@ static struct hso_device *hso_create_bulk_serial_device(
USB_DIR_IN);
if (!serial->in_endp) {
dev_err(&interface->dev, "Failed to find BULK IN ep\n");
- goto exit;
+ goto exit2;
}
if (!
(serial->out_endp =
hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) {
dev_err(&interface->dev, "Failed to find BULK IN ep\n");
- goto exit;
+ goto exit2;
}
serial->write_data = hso_std_serial_write_data;
@@ -2231,9 +2231,10 @@ static struct hso_device *hso_create_bulk_serial_device(
/* done, return it */
return hso_dev;
+
+exit2:
+ hso_serial_common_free(serial);
exit:
- if (hso_dev && serial)
- hso_serial_common_free(serial);
kfree(serial);
hso_free_device(hso_dev);
return NULL;