Commit 40ebcb89 authored by Jan Safrata's avatar Jan Safrata Committed by Greg Kroah-Hartman

usb: use usb_serial_put in usb_serial_probe errors

commit 0658a336 upstream.

The use of kfree(serial) in error cases of usb_serial_probe
was invalid - usb_serial structure allocated in create_serial()
gets reference of usb_device that needs to be put, so we need
to use usb_serial_put() instead of simple kfree().
Signed-off-by: default avatarJan Safrata <jan.nikitenko@gmail.com>
Acked-by: default avatarJohan Hovold <jhovold@gmail.com>
Cc: Richard Retanubun <richardretanubun@ruggedcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 328325bf
......@@ -764,7 +764,7 @@ int usb_serial_probe(struct usb_interface *interface,
if (retval) {
dbg("sub driver rejected device");
kfree(serial);
usb_serial_put(serial);
module_put(type->driver.owner);
return retval;
}
......@@ -836,7 +836,7 @@ int usb_serial_probe(struct usb_interface *interface,
*/
if (num_bulk_in == 0 || num_bulk_out == 0) {
dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n");
kfree(serial);
usb_serial_put(serial);
module_put(type->driver.owner);
return -ENODEV;
}
......@@ -850,7 +850,7 @@ int usb_serial_probe(struct usb_interface *interface,
if (num_ports == 0) {
dev_err(&interface->dev,
"Generic device with no bulk out, not allowed.\n");
kfree(serial);
usb_serial_put(serial);
module_put(type->driver.owner);
return -EIO;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment