* [PATCH] Bluetooth: A2MP: Fix potential NULL dereference
[not found] <20120928012323.GG5522@localhost>
@ 2012-09-28 11:28 ` Andrei Emeltchenko
2012-10-01 15:02 ` Gustavo Padovan
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2012-09-28 11:28 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Return INVALID_CTRL_ID for unknown AMP controller and for BR/EDR
controller and fixes dereference possible NULL pointer.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/a2mp.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 61e657a..a55449e 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -278,7 +278,7 @@ static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb,
BT_DBG("id %d", req->id);
hdev = hci_dev_get(req->id);
- if (!hdev) {
+ if (!hdev || hdev->dev_type != HCI_AMP) {
struct a2mp_info_rsp rsp;
rsp.id = req->id;
@@ -286,14 +286,16 @@ static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb,
a2mp_send(mgr, A2MP_GETINFO_RSP, hdr->ident, sizeof(rsp),
&rsp);
- }
- if (hdev->dev_type != HCI_BREDR) {
- mgr->state = READ_LOC_AMP_INFO;
- hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL);
+ goto done;
}
- hci_dev_put(hdev);
+ mgr->state = READ_LOC_AMP_INFO;
+ hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL);
+
+done:
+ if (hdev)
+ hci_dev_put(hdev);
skb_pull(skb, sizeof(*req));
return 0;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: A2MP: Fix potential NULL dereference
2012-09-28 11:28 ` [PATCH] Bluetooth: A2MP: Fix potential NULL dereference Andrei Emeltchenko
@ 2012-10-01 15:02 ` Gustavo Padovan
0 siblings, 0 replies; 2+ messages in thread
From: Gustavo Padovan @ 2012-10-01 15:02 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-28 14:28:50 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Return INVALID_CTRL_ID for unknown AMP controller and for BR/EDR
> controller and fixes dereference possible NULL pointer.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/a2mp.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
Patch has been applied to bluetooth-next, Thanks.
Gustavo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-01 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20120928012323.GG5522@localhost>
2012-09-28 11:28 ` [PATCH] Bluetooth: A2MP: Fix potential NULL dereference Andrei Emeltchenko
2012-10-01 15:02 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).