* [PATCH] Bluetooth: hci_conn_failed: Fix memory leak
@ 2023-10-08 6:03 Yuran Pereira
2023-10-08 6:05 ` Greg KH
2023-10-08 6:15 ` bluez.test.bot
0 siblings, 2 replies; 3+ messages in thread
From: Yuran Pereira @ 2023-10-08 6:03 UTC (permalink / raw)
To: marcel
Cc: Yuran Pereira, johan.hedberg, gregkh, luiz.dentz,
linux-kernel-mentees, linux-kernel, linux-bluetooth,
syzbot+39ec16ff6cc18b1d066d
The hci_conn_failed() function currently calls hci_connect_cfm(), which
indirectly leads to the allocation of an l2cap_conn struct in
l2cap_conn_add().
This operation results in a memory leak, as the l2cap_conn structure
becomes unreferenced.
To address this issue and prevent the memory leak, this patch modifies
hci_conn_failed() to replace the call to hci_connect_cfm() with a
call to hci_disconn_cfm().
Fixes: 9b3628d79b46 ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted")
Reported-by: syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d
Signed-off-by: Yuran Pereira <yuran.pereira@hotmail.com>
---
net/bluetooth/hci_conn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 7a6f20338db8..1d2d03b4a98a 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1248,7 +1248,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 status)
}
conn->state = BT_CLOSED;
- hci_connect_cfm(conn, status);
+ hci_disconn_cfm(conn, status);
hci_conn_del(conn);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Bluetooth: hci_conn_failed: Fix memory leak 2023-10-08 6:03 [PATCH] Bluetooth: hci_conn_failed: Fix memory leak Yuran Pereira @ 2023-10-08 6:05 ` Greg KH 2023-10-08 6:15 ` bluez.test.bot 1 sibling, 0 replies; 3+ messages in thread From: Greg KH @ 2023-10-08 6:05 UTC (permalink / raw) To: Yuran Pereira Cc: marcel, johan.hedberg, luiz.dentz, linux-kernel-mentees, linux-kernel, linux-bluetooth, syzbot+39ec16ff6cc18b1d066d On Sun, Oct 08, 2023 at 11:33:34AM +0530, Yuran Pereira wrote: > The hci_conn_failed() function currently calls hci_connect_cfm(), which > indirectly leads to the allocation of an l2cap_conn struct in > l2cap_conn_add(). > This operation results in a memory leak, as the l2cap_conn structure > becomes unreferenced. > > To address this issue and prevent the memory leak, this patch modifies > hci_conn_failed() to replace the call to hci_connect_cfm() with a > call to hci_disconn_cfm(). > > Fixes: 9b3628d79b46 ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted") > Reported-by: syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d > Signed-off-by: Yuran Pereira <yuran.pereira@hotmail.com> > --- > net/bluetooth/hci_conn.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c > index 7a6f20338db8..1d2d03b4a98a 100644 > --- a/net/bluetooth/hci_conn.c > +++ b/net/bluetooth/hci_conn.c > @@ -1248,7 +1248,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 status) > } > > conn->state = BT_CLOSED; > - hci_connect_cfm(conn, status); > + hci_disconn_cfm(conn, status); > hci_conn_del(conn); > } > > -- > 2.25.1 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documetnation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Bluetooth: hci_conn_failed: Fix memory leak 2023-10-08 6:03 [PATCH] Bluetooth: hci_conn_failed: Fix memory leak Yuran Pereira 2023-10-08 6:05 ` Greg KH @ 2023-10-08 6:15 ` bluez.test.bot 1 sibling, 0 replies; 3+ messages in thread From: bluez.test.bot @ 2023-10-08 6:15 UTC (permalink / raw) To: linux-bluetooth, yuran.pereira [-- Attachment #1: Type: text/plain, Size: 551 bytes --] This is an automated email and please do not reply to this email. Dear Submitter, Thank you for submitting the patches to the linux bluetooth mailing list. While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository. ----- Output ----- error: patch failed: net/bluetooth/hci_conn.c:1248 error: net/bluetooth/hci_conn.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch Please resolve the issue and submit the patches again. --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-08 6:15 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-08 6:03 [PATCH] Bluetooth: hci_conn_failed: Fix memory leak Yuran Pereira 2023-10-08 6:05 ` Greg KH 2023-10-08 6:15 ` bluez.test.bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox