Bluetooth: Force -EIO from tty read/write if .activate() fails

If rfcomm_dlc_open() fails, set tty into error state which returns
-EIO from reads and writes.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Tested-By: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Peter Hurley 2014-02-09 20:59:21 -05:00 committed by Marcel Holtmann
parent fb856e5090
commit 5326a4ee98
1 changed files with 5 additions and 1 deletions

View File

@ -111,8 +111,12 @@ static void rfcomm_dev_destruct(struct tty_port *port)
static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty)
{
struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port);
int err;
return rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel);
err = rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel);
if (err)
set_bit(TTY_IO_ERROR, &tty->flags);
return err;
}
/* we block the open until the dlc->state becomes BT_CONNECTED */