Skip to content

Commit

Permalink
USB: serial: fix interface refcounting
Browse files Browse the repository at this point in the history
Make sure the interface is not released before our serial device.

Note that drivers are still not allowed to access the interface in
any way that may interfere with another driver that may have gotten
bound to the same interface after disconnect returns.

Cc: stable <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jhovold authored and gregkh committed Mar 21, 2013
1 parent 5492bf3 commit d797105
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static void destroy_serial(struct kref *kref)
}
}

usb_put_intf(serial->interface);
usb_put_dev(serial->dev);
kfree(serial);
}
Expand Down Expand Up @@ -620,7 +621,7 @@ static struct usb_serial *create_serial(struct usb_device *dev,
}
serial->dev = usb_get_dev(dev);
serial->type = driver;
serial->interface = interface;
serial->interface = usb_get_intf(interface);
kref_init(&serial->kref);
mutex_init(&serial->disc_mutex);
serial->minor = SERIAL_TTY_NO_MINOR;
Expand Down

0 comments on commit d797105

Please sign in to comment.