2013-07-09 17:05:14

by Gianluca Anzolin

[permalink] [raw]
Subject: [PATCH 2/2] Fix tty_port refcounting in rfcomm/tty.c

In net/bluetooth/rfcomm/tty.c the reference counting of tty_port doesn't work
as expected and the port may be destroyed under our feet while being used.

For example a forced disconnect with an open rfcomm port causes OOPSes in
rfcomm_dev_destruct, because the device is still attached to the list even
though it should have been deleted before.

The code manually checks dev->port.count to find if the device should be
destroyed instead of using proper refcounting.

The fix hooks install and cleanup methods which take care of the refcounting of
the ports. It also hooks activate and shutdown methods for tty_port to take
care of rfcomm_dlc handling.

The changes were heavily inspired by the code in usb-serial.c

Signed-off-by: Gianluca Anzolin <[email protected]>


Attachments:
(No filename) (776.00 B)
rfcomm-tty-port.patch (15.24 kB)
Download all attachments