]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Fix the reference counting of tty_port
authorGianluca Anzolin <gianluca@sottospazio.it>
Mon, 29 Jul 2013 15:08:12 +0000 (17:08 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 21 Aug 2013 14:47:07 +0000 (16:47 +0200)
commit41b520a00e5b6fe20e9a3206eeb256bcb8976e3e
tree169cd2b7e414a06f7e35b522ab3a4fa4105ea8ca
parent60f0a82534923c72034aa4edf9f166ad9b1b2a8f
Bluetooth: Fix the reference counting of tty_port

The tty_port can be released in two cases: when we get a HUP in the
functions rfcomm_tty_hangup() and rfcomm_dev_state_change(). Or when the
user releases the device in rfcomm_release_dev().

In these cases we set the flag RFCOMM_TTY_RELEASED so that no other
function can get a reference to the tty_port.
The use of !test_and_set_bit(RFCOMM_TTY_RELEASED) ensures that the
'initial' tty_port reference is only dropped once.

The rfcomm_dev_del function is removed becase it isn't used anymore.

Signed-off-by: Gianluca Anzolin <gianluca@sottospazio.it>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/rfcomm/tty.c