Skip to content

Commit d797105

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: fix interface refcounting
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]>
1 parent 5492bf3 commit d797105

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/serial/usb-serial.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ static void destroy_serial(struct kref *kref)
151151
}
152152
}
153153

154+
usb_put_intf(serial->interface);
154155
usb_put_dev(serial->dev);
155156
kfree(serial);
156157
}
@@ -620,7 +621,7 @@ static struct usb_serial *create_serial(struct usb_device *dev,
620621
}
621622
serial->dev = usb_get_dev(dev);
622623
serial->type = driver;
623-
serial->interface = interface;
624+
serial->interface = usb_get_intf(interface);
624625
kref_init(&serial->kref);
625626
mutex_init(&serial->disc_mutex);
626627
serial->minor = SERIAL_TTY_NO_MINOR;

0 commit comments

Comments
 (0)