diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-01-28 15:16:50 -0800 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-02-13 09:51:39 +0200 |
commit | 35364c99d20edc7329843e2a6dad6851d77eafd7 (patch) | |
tree | 2710e8fc985f8af341fa03a2c6d86dfc75ed9433 /net/bluetooth/rfcomm | |
parent | b783fbc3a55691f978b9f78d552a0d7e7d2705ad (diff) | |
download | linux-35364c99d20edc7329843e2a6dad6851d77eafd7.tar.bz2 |
Bluetooth: Refuse peer RFCOMM address reading when not connected
When we're not connected the peer address information is undefined. This
patch fixes the remote address getting to return a proper error in case
the sate is anything else than BT_CONNECTED.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index fb8158af1f39..00573fb79030 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -528,6 +528,9 @@ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int * BT_DBG("sock %p, sk %p", sock, sk); + if (peer && sk->sk_state != BT_CONNECTED) + return -ENOTCONN; + memset(sa, 0, sizeof(*sa)); sa->rc_family = AF_BLUETOOTH; sa->rc_channel = rfcomm_pi(sk)->channel; |