diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2015-07-20 19:31:25 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-07-23 16:41:24 +0200 |
commit | 25ba265390c09b0a2b2f3fd9ba82e37248b7a371 (patch) | |
tree | c8b2d2203008ca2a55d261b0e9bdcb645a38f66a /net | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (diff) | |
download | linux-25ba265390c09b0a2b2f3fd9ba82e37248b7a371.tar.xz linux-25ba265390c09b0a2b2f3fd9ba82e37248b7a371.zip |
Bluetooth: Fix NULL pointer dereference in smp_conn_security
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 <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 4.0+
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/smp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 3d0f7d2a0616..ad82324f710f 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -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; |