aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-12-06 16:02:05 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-06 16:02:05 -0500
commit5f779bbd472cdb2046ff8b672ad8c5b62b61cd19 (patch)
tree151dc07e9a69dd48e38251ba88811490ca16969a /net/bluetooth/l2cap_sock.c
parentd7a4858c0fde8383f7aa494eda0fba6bef3f2fec (diff)
parent5a13b09531420d230616bd524b68a5b0c23cd487 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r--net/bluetooth/l2cap_sock.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index e2e785c74630..f73704321a77 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -626,8 +626,13 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
626 626
627 chan->sec_level = sec.level; 627 chan->sec_level = sec.level;
628 628
629 if (!chan->conn)
630 break;
631
629 conn = chan->conn; 632 conn = chan->conn;
630 if (conn && chan->scid == L2CAP_CID_LE_DATA) { 633
634 /*change security for LE channels */
635 if (chan->scid == L2CAP_CID_LE_DATA) {
631 if (!conn->hcon->out) { 636 if (!conn->hcon->out) {
632 err = -EINVAL; 637 err = -EINVAL;
633 break; 638 break;
@@ -635,9 +640,14 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
635 640
636 if (smp_conn_security(conn, sec.level)) 641 if (smp_conn_security(conn, sec.level))
637 break; 642 break;
638
639 err = 0;
640 sk->sk_state = BT_CONFIG; 643 sk->sk_state = BT_CONFIG;
644
645 /* or for ACL link, under defer_setup time */
646 } else if (sk->sk_state == BT_CONNECT2 &&
647 bt_sk(sk)->defer_setup) {
648 err = l2cap_chan_check_security(chan);
649 } else {
650 err = -EINVAL;
641 } 651 }
642 break; 652 break;
643 653