Bluetooth: report the right security level in getsockopt
authorGustavo Padovan <gustavo@padovan.org>
Mon, 7 May 2012 06:07:26 +0000 (03:07 -0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 16 May 2012 19:14:09 +0000 (16:14 -0300)
During a security level elevation we need to keep track of the current
security level of a connection until the new one is not confirmed.

Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/l2cap_sock.c

index f6d8e13197d681d67b6cbf4041350a1fc5e73b70..f52d58e05d028eac5dd38ceda1b628c307addc01 100644 (file)
@@ -379,7 +379,10 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
                }
 
                memset(&sec, 0, sizeof(sec));
-               sec.level = chan->sec_level;
+               if (chan->conn)
+                       sec.level = chan->conn->hcon->sec_level;
+               else
+                       sec.level = chan->sec_level;
 
                if (sk->sk_state == BT_CONNECTED)
                        sec.key_size = chan->conn->hcon->enc_key_size;