Bluetooth: Fix possible NULL pointer dereference
Subsystems (2)
PATCH v2 1/1 Bluetooth: Fix possible NULL pointer dereference
Checking conn->pending_sec_level if there is no connection leads to potential null pointer dereference. Don't process pin_code_request_event at all if no connection exists.
Signed-off-by Waldemar Rymarkiewicz <[email protected]>
--- net/bluetooth/hci_event.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
net/bluetooth/hci_event.c +5 -1
@@ -2175,7 +2175,10 @@ static inline void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buffhci_dev_lock (hdev); conn =hci_conn_hash_lookup_ba (hdev,ACL_LINK , &ev->bdaddr); -if (conn && conn->state ==BT_CONNECTED ) { +if (!conn) + goto unlock; + +if (conn->state ==BT_CONNECTED ) {hci_conn_hold (conn); conn->disc_timeout =HCI_PAIRING_TIMEOUT ;hci_conn_put (conn);
@@ -2195,6 +2198,7 @@ static inline void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buffmgmt_pin_code_request (hdev->id, &ev->bdaddr, secure); } +unlock:hci_dev_unlock (hdev); }
Signature · 1 line
1.7.6.3
Hi Waldemar,
Quoted 5 lines
Checking
conn->pending_sec_levelif there is no connection leads to potential null pointer dereference. Don't processpin_code_request_eventat all if no connection exists.Signed-off-by Waldemar Rymarkiewicz <[email protected]>
Acked-by Marcel Holtmann <[email protected]>
Regards
Marcel
Gustavo,
Quoted 5 lines
Quoted 2 lines
Signed-off-by Waldemar Rymarkiewicz<[email protected]>Acked-by Marcel Holtmann<[email protected]>
Will you apply this patch?
Thanks,
/Waldek
Gustavo Padovan
AppliedHi Waldemar,
Quoted 8 lines · Waldemar Rymarkiewicz
Checking
conn->pending_sec_levelif there is no connection leads to potential null pointer dereference. Don't processpin_code_request_eventat all if no connection exists.Signed-off-by Waldemar Rymarkiewicz <[email protected]>--- net/bluetooth/hci_event.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
Applied, thanks.
Gustavo