]> git.karo-electronics.de Git - linux-beck.git/blobdiff - net/bluetooth/smp.c
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[linux-beck.git] / net / bluetooth / smp.c
index 463e50c58716359925c975acf6776db91985f397..4b07acb8293c3df3542e2a1661a6ae07bcfa6596 100644 (file)
@@ -742,6 +742,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
 
        BT_DBG("conn %p", conn);
 
+       if (!(conn->hcon->link_mode & HCI_LM_MASTER))
+               return SMP_CMD_NOTSUPP;
+
        hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req);
 
        if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
@@ -856,7 +859,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
 
        if (hcon->type != LE_LINK) {
                kfree_skb(skb);
-               return -ENOTSUPP;
+               return 0;
        }
 
        if (skb->len < 1) {
@@ -864,7 +867,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
                return -EILSEQ;
        }
 
-       if (!test_bit(HCI_LE_ENABLED, &conn->hcon->hdev->dev_flags)) {
+       if (!test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags)) {
                err = -ENOTSUPP;
                reason = SMP_PAIRING_NOTSUPP;
                goto done;