diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-02-09 20:59:21 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-14 16:39:32 -0500 |
commit | 5326a4ee982703ddba14a9821fe5cb10d122e1b0 (patch) | |
tree | af750c07450faef2f74726c00d00f40baf8b9c26 /net/bluetooth | |
parent | fb856e50900a84dd9f8d50d3882eb4a26ba6ea54 (diff) |
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>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 375b60dae04d..f6b9f0c4c29e 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -111,8 +111,12 @@ static void rfcomm_dev_destruct(struct tty_port *port) | |||
111 | static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty) | 111 | static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty) |
112 | { | 112 | { |
113 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); | 113 | struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port); |
114 | int err; | ||
114 | 115 | ||
115 | return rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel); | 116 | err = rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel); |
117 | if (err) | ||
118 | set_bit(TTY_IO_ERROR, &tty->flags); | ||
119 | return err; | ||
116 | } | 120 | } |
117 | 121 | ||
118 | /* we block the open until the dlc->state becomes BT_CONNECTED */ | 122 | /* we block the open until the dlc->state becomes BT_CONNECTED */ |