提交 0658a336 编写于 作者: J Jan Safrata 提交者: Greg Kroah-Hartman

usb: use usb_serial_put in usb_serial_probe errors

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: NJan Safrata <jan.nikitenko@gmail.com>
Acked-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 07828b10
...@@ -757,7 +757,7 @@ static int usb_serial_probe(struct usb_interface *interface, ...@@ -757,7 +757,7 @@ static int usb_serial_probe(struct usb_interface *interface,
if (retval) { if (retval) {
dbg("sub driver rejected device"); dbg("sub driver rejected device");
kfree(serial); usb_serial_put(serial);
module_put(type->driver.owner); module_put(type->driver.owner);
return retval; return retval;
} }
...@@ -829,7 +829,7 @@ static int usb_serial_probe(struct usb_interface *interface, ...@@ -829,7 +829,7 @@ static int usb_serial_probe(struct usb_interface *interface,
*/ */
if (num_bulk_in == 0 || num_bulk_out == 0) { if (num_bulk_in == 0 || num_bulk_out == 0) {
dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); 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); module_put(type->driver.owner);
return -ENODEV; return -ENODEV;
} }
...@@ -843,7 +843,7 @@ static int usb_serial_probe(struct usb_interface *interface, ...@@ -843,7 +843,7 @@ static int usb_serial_probe(struct usb_interface *interface,
if (num_ports == 0) { if (num_ports == 0) {
dev_err(&interface->dev, dev_err(&interface->dev,
"Generic device with no bulk out, not allowed.\n"); "Generic device with no bulk out, not allowed.\n");
kfree(serial); usb_serial_put(serial);
module_put(type->driver.owner); module_put(type->driver.owner);
return -EIO; return -EIO;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册