Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1751931iof; Tue, 7 Jun 2022 10:47:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkHQKicgxyyrnfxMBm4qKV9eOTjgykl2PQwTzNZmCDoBmLQYlVV+lhJenUGUU4aNFb6va/ X-Received: by 2002:a17:906:600c:b0:6fe:9204:959b with SMTP id o12-20020a170906600c00b006fe9204959bmr28084122ejj.417.1654624071047; Tue, 07 Jun 2022 10:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654624071; cv=none; d=google.com; s=arc-20160816; b=IlDB3ZC3UPKL0pjC9LI7PHomQ46FUpaeF5clcYK+Ye6raRG/agBY0OSpuZtbgEUxWX hV/gvQzhZvwFV434a9diKbL27iMWU6IxI2UOYpGiNbjorpGJoS+KzOrn57T6w2L2x+97 EvCImJQNT+Eeb7VYwxfbxMTG7YMeQrGT1kSIvqpPRUBw6t6MEwMiHAHf4wUcdFuom4Tj FnwjupmY6PRVLaKFNikLFnyCgz/7bauW0gWOqsQtaWc4XZjJxxkvhSAwE2nyhPV3aF0U jGa5N072ptNhO20bOoiq91QoDFkJPLLbYayE1iThNNdRfPSK4iHuxKVdSvUW3u33ThnI U06A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=uNPsyShOFiuwQGXJNt++4+eFtCC9VoD+9K2/mAYK9QI=; b=CVmn93BUvfBeYXapmkeP5GCMa0HU5VLemOBnXMefb95j0DpEN2lZp3QKDkJMfy8fXW 68ztZB2bF9q8q4Y0ApRR9YCcqIiKGyhUnZCX2IrIB35Oi2ujAG85Mh2ei5efEDiaVkru NVB/Lub8d3bej2ZA5iJRXhmRBCdwJ8H93SGWt2qc78uz7q/MLoAeZl1Z4nk4uZgYH8D4 h50nz4YavlpXZNFcJbJJ++cYAmqKpc73MKKSHLn6BrMV9Fq88B+CBjdOrQtD3sxlapkN SMigHUx2qrn5OPkETft78u0VZr8yeAYX+ao/Guw3EVXcVaigNuWnGhlINIEOIbDF0MhS 0Xgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=ILXys8kB; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a056402181000b0042ddc352f85si20503979edy.107.2022.06.07.10.47.09; Tue, 07 Jun 2022 10:47:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=ILXys8kB; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344101AbiFGPbx (ORCPT + 99 others); Tue, 7 Jun 2022 11:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245305AbiFGPbw (ORCPT ); Tue, 7 Jun 2022 11:31:52 -0400 Received: from m12-11.163.com (m12-11.163.com [220.181.12.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B0B6F45DE; Tue, 7 Jun 2022 08:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=uNPsyShOFiuwQGXJNt ++4+eFtCC9VoD+9K2/mAYK9QI=; b=ILXys8kBZMpjoIDZoqm9tHve4Jy6dqU3Ul 1RWqpQVQHZWue1xgMBwJ4QzgfLM6RZerSdeMo9k3woQ1aZp/NEJaQogIoGa51mdG Z2tbEJ8boPcW5VrGSwTg77NCLeYpwvMJEx6+JYJ3yrkcyVVe1qVKhud9GB4l7iKc xM+e5xo+Y= Received: from localhost.localdomain (unknown [202.112.113.212]) by smtp7 (Coremail) with SMTP id C8CowADncKANb59i1gX+Gg--.1343S4; Tue, 07 Jun 2022 23:30:26 +0800 (CST) From: Xiaohui Zhang To: Xiaohui Zhang , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xiaohui Zhang Subject: [PATCH 1/1] Bluetooth: use memset avoid memory leaks Date: Tue, 7 Jun 2022 23:30:20 +0800 Message-Id: <20220607153020.29430-1-ruc_zhangxiaohui@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: C8CowADncKANb59i1gX+Gg--.1343S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtw18JFy3Xw48AFW5WF4xtFb_yoWfWFX_uw 4ruayfZa1rJ34Iya12yF48u3W2yan5ZrZ5GrnaqrWUX34UGw47Krs2gFnxWrn7K39ruFy3 ArZ8JryrAw48JjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRMvtCDUUUUU== X-Originating-IP: [202.112.113.212] X-CM-SenderInfo: puxfs6pkdqw5xldrx3rl6rljoofrz/1tbiThIZMFUDPaLqywAAsd X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Xiaohui Zhang Similar to the handling of l2cap_ecred_connect in commit d3715b2333e9 ("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 Signed-off-by: Xiaohui Zhang --- 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 ae78490ecd3d..09ecaf556de5 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1369,6 +1369,7 @@ static void l2cap_le_connect(struct l2cap_chan *chan) l2cap_le_flowctl_init(chan, 0); + memset(&req, 0, sizeof(req)); req.psm = chan->psm; req.scid = cpu_to_le16(chan->scid); req.mtu = cpu_to_le16(chan->imtu); -- 2.17.1