* [PATCH] Bluetooth: AMP: Fix possible NULL dereference
@ 2012-10-04 10:31 Andrei Emeltchenko
0 siblings, 0 replies; only message in thread
From: Andrei Emeltchenko @ 2012-10-04 10:31 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Check that link key exist before accessing.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/amp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index c933c72..7e4a1e5 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -185,6 +185,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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-10-04 10:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-04 10:31 [PATCH] Bluetooth: AMP: Fix possible NULL dereference Andrei Emeltchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox