* [PATCH] Bluetooth: hci_conn: Fix potential memleak in iso_listen_bis()
@ 2022-11-08 11:23 Wang ShaoBo
2022-11-08 23:41 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 3+ messages in thread
From: Wang ShaoBo @ 2022-11-08 11:23 UTC (permalink / raw)
Cc: luiz.von.dentz, luiz.dentz, pabeni, liwei391, linux-bluetooth,
netdev, linux-kernel
When hci_pa_create_sync() failed, hdev should be freed as there
was no place to handle its recycling after.
Fixes: f764a6c2c1e4 ("Bluetooth: ISO: Add broadcast support")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
net/bluetooth/iso.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index f825857db6d0..4e3867110dc1 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -880,6 +880,9 @@ static int iso_listen_bis(struct sock *sk)
hci_dev_unlock(hdev);
+ if (err)
+ hci_dev_put(hdev);
+
return err;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: hci_conn: Fix potential memleak in iso_listen_bis()
2022-11-08 11:23 [PATCH] Bluetooth: hci_conn: Fix potential memleak in iso_listen_bis() Wang ShaoBo
@ 2022-11-08 23:41 ` Luiz Augusto von Dentz
2022-11-09 2:13 ` Wangshaobo (bobo)
0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-11-08 23:41 UTC (permalink / raw)
To: Wang ShaoBo
Cc: luiz.von.dentz, pabeni, liwei391, linux-bluetooth, netdev, linux-kernel
Hi Wang,
On Tue, Nov 8, 2022 at 3:24 AM Wang ShaoBo <bobo.shaobowang@huawei.com> wrote:
>
> When hci_pa_create_sync() failed, hdev should be freed as there
> was no place to handle its recycling after.
The patch itself seems fine but the description is misleading since we
are not freeing the hdev instead we are jus releasing the reference we
got.
> Fixes: f764a6c2c1e4 ("Bluetooth: ISO: Add broadcast support")
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
> ---
> net/bluetooth/iso.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
> index f825857db6d0..4e3867110dc1 100644
> --- a/net/bluetooth/iso.c
> +++ b/net/bluetooth/iso.c
> @@ -880,6 +880,9 @@ static int iso_listen_bis(struct sock *sk)
>
> hci_dev_unlock(hdev);
>
> + if (err)
> + hci_dev_put(hdev);
Not sure why you are not always calling hci_dev_put?
> return err;
> }
>
> --
> 2.25.1
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: hci_conn: Fix potential memleak in iso_listen_bis()
2022-11-08 23:41 ` Luiz Augusto von Dentz
@ 2022-11-09 2:13 ` Wangshaobo (bobo)
0 siblings, 0 replies; 3+ messages in thread
From: Wangshaobo (bobo) @ 2022-11-09 2:13 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: luiz.von.dentz, pabeni, liwei391, linux-bluetooth, netdev, linux-kernel
在 2022/11/9 7:41, Luiz Augusto von Dentz 写道:
> Hi Wang,
>
> On Tue, Nov 8, 2022 at 3:24 AM Wang ShaoBo <bobo.shaobowang@huawei.com> wrote:
>> When hci_pa_create_sync() failed, hdev should be freed as there
>> was no place to handle its recycling after.
> The patch itself seems fine but the description is misleading since we
> are not freeing the hdev instead we are jus releasing the reference we
> got.
>
>> Fixes: f764a6c2c1e4 ("Bluetooth: ISO: Add broadcast support")
>> Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
>> ---
>> net/bluetooth/iso.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
>> index f825857db6d0..4e3867110dc1 100644
>> --- a/net/bluetooth/iso.c
>> +++ b/net/bluetooth/iso.c
>> @@ -880,6 +880,9 @@ static int iso_listen_bis(struct sock *sk)
>>
>> hci_dev_unlock(hdev);
>>
>> + if (err)
>> + hci_dev_put(hdev);
> Not sure why you are not always calling hci_dev_put?
emm, I would have thought that the reference would be released after
calling hci_cmd_sync_queue(), but in fact actually not.
-- Wang ShaoBo
>
>> return err;
>> }
>>
>> --
>> 2.25.1
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-09 2:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 11:23 [PATCH] Bluetooth: hci_conn: Fix potential memleak in iso_listen_bis() Wang ShaoBo
2022-11-08 23:41 ` Luiz Augusto von Dentz
2022-11-09 2:13 ` Wangshaobo (bobo)
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).