aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2011-07-08 17:31:46 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-07-08 17:39:31 -0400
commit8f360119243c214eb5c5549c61981d51a276154a (patch)
treefc5fce3d33d7cfcbf4326936f35e2382473b334c /net/bluetooth
parent726b4ffcaa450d9593b9b6ac8605967ce9f3e506 (diff)
Bluetooth: Add support for returning the encryption key size
This will be useful when userspace wants to restrict some kinds of operations based on the length of the key size used to encrypt the link. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/l2cap_sock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 146b614d10ed..5c36b3e8739c 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -422,8 +422,12 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
422 break; 422 break;
423 } 423 }
424 424
425 memset(&sec, 0, sizeof(sec));
425 sec.level = chan->sec_level; 426 sec.level = chan->sec_level;
426 427
428 if (sk->sk_state == BT_CONNECTED)
429 sec.key_size = chan->conn->hcon->enc_key_size;
430
427 len = min_t(unsigned int, len, sizeof(sec)); 431 len = min_t(unsigned int, len, sizeof(sec));
428 if (copy_to_user(optval, (char *) &sec, len)) 432 if (copy_to_user(optval, (char *) &sec, len))
429 err = -EFAULT; 433 err = -EFAULT;