[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251107022102.266003-1-13875017792@163.com>
Date: Fri, 7 Nov 2025 10:21:02 +0800
From: Gongwei Li <13875017792@....com>
To: marcel@...tmann.org
Cc: johan.hedberg@...il.com,
luiz.dentz@...il.com,
linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org,
Gongwei Li <ligongwei@...inos.cn>
Subject: [PATCH] Bluetooth: use memset avoid memory leaks
From: Gongwei Li <ligongwei@...inos.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@...inos.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
Powered by blists - more mailing lists