diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-08-27 18:02:37 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-24 18:49:03 -0400 |
commit | e57b641dfafc10ce23d26cf271fd2638589fdb3f (patch) | |
tree | f5e4bf382cffe1b82cc75b3017fe014649e70029 /drivers/net/usb/hso.c | |
parent | 54069511633ca9d5b4e5d45cf32ffea06697c88b (diff) |
[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.c | 9 |
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( | |||
2211 | USB_DIR_IN); | 2211 | USB_DIR_IN); |
2212 | if (!serial->in_endp) { | 2212 | if (!serial->in_endp) { |
2213 | dev_err(&interface->dev, "Failed to find BULK IN ep\n"); | 2213 | dev_err(&interface->dev, "Failed to find BULK IN ep\n"); |
2214 | goto exit; | 2214 | goto exit2; |
2215 | } | 2215 | } |
2216 | 2216 | ||
2217 | if (! | 2217 | if (! |
2218 | (serial->out_endp = | 2218 | (serial->out_endp = |
2219 | hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) { | 2219 | hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) { |
2220 | dev_err(&interface->dev, "Failed to find BULK IN ep\n"); | 2220 | dev_err(&interface->dev, "Failed to find BULK IN ep\n"); |
2221 | goto exit; | 2221 | goto exit2; |
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | serial->write_data = hso_std_serial_write_data; | 2224 | serial->write_data = hso_std_serial_write_data; |
@@ -2231,9 +2231,10 @@ static struct hso_device *hso_create_bulk_serial_device( | |||
2231 | 2231 | ||
2232 | /* done, return it */ | 2232 | /* done, return it */ |
2233 | return hso_dev; | 2233 | return hso_dev; |
2234 | |||
2235 | exit2: | ||
2236 | hso_serial_common_free(serial); | ||
2234 | exit: | 2237 | exit: |
2235 | if (hso_dev && serial) | ||
2236 | hso_serial_common_free(serial); | ||
2237 | kfree(serial); | 2238 | kfree(serial); |
2238 | hso_free_device(hso_dev); | 2239 | hso_free_device(hso_dev); |
2239 | return NULL; | 2240 | return NULL; |