linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: use memset avoid memory leaks
@ 2025-11-07  2:21 Gongwei Li
  2025-11-07  3:13 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Gongwei Li @ 2025-11-07  2:21 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
	Gongwei Li

From: Gongwei Li <ligongwei@kylinos.cn>

Similar to the handling of l2cap_le_connect in commit a5133fe87ed8
("Bluetooth: use memset avoid memory leaks"), we thought a patch
might be needed here as well.

Use memset to initialize structs to prevent memory leaks
in __l2cap_le_connect_rsp_defer.

Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
---
 net/bluetooth/l2cap_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d08320380..b987ba5de 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3786,6 +3786,7 @@ void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan)
 
 	BT_DBG("chan %p", chan);
 
+	memset(&rsp, 0, sizeof(rsp));
 	rsp.dcid    = cpu_to_le16(chan->scid);
 	rsp.mtu     = cpu_to_le16(chan->imtu);
 	rsp.mps     = cpu_to_le16(chan->mps);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-07  3:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07  2:21 [PATCH] Bluetooth: use memset avoid memory leaks Gongwei Li
2025-11-07  3:13 ` 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;
as well as URLs for NNTP newsgroup(s).