diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-26 09:49:18 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-03-26 12:31:33 -0400 |
commit | e8b1ab9e6d30394e0df3e4f60bf56c4dc9bf0863 (patch) | |
tree | d3695da156cb780b4fee75d76168e85abd5a46dc /net/bluetooth/rfcomm/sock.c | |
parent | 8396215d4865d66be9cdfcec8d135862e1fd98d1 (diff) |
Bluetooth: Fix returning peer address in pending connect state
We should let user space request the peer address also in the pending
connect states, i.e. BT_CONNECT and BT_CONNECT2. There is existing user
space code that tries to do this and will fail without extending the set
of allowed states for the peer address information.
This patch adds the two states to the allowed ones in the L2CAP and
RFCOMM sock_getname functions, thereby preventing ENOTCONN from being
returned.
Reported-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/rfcomm/sock.c')
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index c024e715512f..eabd25ab5ad9 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -534,7 +534,8 @@ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int * | |||
534 | 534 | ||
535 | BT_DBG("sock %p, sk %p", sock, sk); | 535 | BT_DBG("sock %p, sk %p", sock, sk); |
536 | 536 | ||
537 | if (peer && sk->sk_state != BT_CONNECTED) | 537 | if (peer && sk->sk_state != BT_CONNECTED && |
538 | sk->sk_state != BT_CONNECT && sk->sk_state != BT_CONNECT2) | ||
538 | return -ENOTCONN; | 539 | return -ENOTCONN; |
539 | 540 | ||
540 | memset(sa, 0, sizeof(*sa)); | 541 | memset(sa, 0, sizeof(*sa)); |