Skip to content

Commit

Permalink
Bluetooth: Fix NULL pointer dereference in smp_conn_security
Browse files Browse the repository at this point in the history
The l2cap_conn->smp pointer may be NULL for various valid reasons where SMP has
failed to initialize properly. One such scenario is when crypto support is
missing, another when the adapter has been powered on through a legacy method.
The smp_conn_security() function should have the appropriate check for this
situation to avoid NULL pointer dereferences.

Signed-off-by: Johan Hedberg <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
Cc: [email protected] # 4.0+
  • Loading branch information
Johan Hedberg authored and holtmann committed Jul 23, 2015
1 parent c5dfd65 commit 25ba265
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,10 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
return 1;

chan = conn->smp;
if (!chan) {
BT_ERR("SMP security requested but not available");
return 1;
}

if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
return 1;
Expand Down

0 comments on commit 25ba265

Please sign in to comment.