diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-10-05 15:56:53 +0200 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-10-08 00:14:30 +0200 |
commit | 079db0c6e3854b3af9808268f3b884fa48ed0034 (patch) | |
tree | d65a7dca5ba34a0822d6c2c6721da78401b88cfa /net/bluetooth/amp.c | |
parent | Bluetooth: remove unused member of hci_dev. (diff) | |
download | linux-079db0c6e3854b3af9808268f3b884fa48ed0034.tar.xz linux-079db0c6e3854b3af9808268f3b884fa48ed0034.zip |
Bluetooth: AMP: Fix possible NULL dereference
Check that link key exist before accessing.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/amp.c')
-rw-r--r-- | net/bluetooth/amp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 5dab2d1c7c82..b6e1c3ac74f1 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c @@ -184,6 +184,10 @@ int phylink_gen_key(struct hci_conn *conn, u8 *data, u8 *len, u8 *type) *len = HCI_AMP_LINK_KEY_SIZE; key = hci_find_link_key(hdev, &conn->dst); + if (!key) { + BT_DBG("No Link key for conn %p dst %pMR", conn, &conn->dst); + return -EACCES; + } /* BR/EDR Link Key concatenated together with itself */ memcpy(&keybuf[0], key->val, HCI_LINK_KEY_SIZE); |