]> Pileus Git - ~andy/linux/commit
Bluetooth: Always wait for a connection on RFCOMM open()
authorGianluca Anzolin <gianluca@sottospazio.it>
Mon, 6 Jan 2014 20:23:52 +0000 (21:23 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 6 Jan 2014 21:51:45 +0000 (13:51 -0800)
commit4a2fb3ecc7467c775b154813861f25a0ddc11aa0
tree7673d900599d3fe9c053483d58e171d20aa55e69
parente228b63390536f5b737056059a9a04ea016b1abf
Bluetooth: Always wait for a connection on RFCOMM open()

This patch fixes two regressions introduced with the recent rfcomm tty
rework.

The current code uses the carrier_raised() method to wait for the
bluetooth connection when a process opens the tty.

However processes may open the port with the O_NONBLOCK flag or set the
CLOCAL termios flag: in these cases the open() syscall returns
immediately without waiting for the bluetooth connection to
complete.

This behaviour confuses userspace which expects an established bluetooth
connection.

The patch restores the old behaviour by waiting for the connection in
rfcomm_dev_activate() and removes carrier_raised() from the tty_port ops.

As a side effect the new code also fixes the case in which the rfcomm
tty device is created with the flag RFCOMM_REUSE_DLC: the old code
didn't call device_move() and ModemManager skipped the detection
probe. Now device_move() is always called inside rfcomm_dev_activate().

Signed-off-by: Gianluca Anzolin <gianluca@sottospazio.it>
Reported-by: Andrey Vihrov <andrey.vihrov@gmail.com>
Reported-by: Beson Chow <blc+bluez@mail.vanade.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/rfcomm/tty.c