On Tue, May 22, 2012 at 02:04:50PM +0200, Jan Safrata wrote: > 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: Jan Safrata <jan.nikitenko@xxxxxxxxx> Good catch! Acked-by: Johan Hovold <jhovold@xxxxxxxxx> > --- > drivers/usb/serial/usb-serial.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c > index 584f23c..391c30e 100644 > --- a/drivers/usb/serial/usb-serial.c > +++ b/drivers/usb/serial/usb-serial.c > @@ -770,7 +770,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; > } > @@ -842,7 +842,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; > } > @@ -856,7 +856,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; > } -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html