Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3060826pxb; Mon, 4 Apr 2022 06:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSiL7UJEPQJx/MgC039fOVwihDINz/8WgCX81bxhtN13L03tjSUPCdnDw2OJKuUhPEbOed X-Received: by 2002:a17:907:94ca:b0:6da:b785:f067 with SMTP id dn10-20020a17090794ca00b006dab785f067mr150323ejc.654.1649080659558; Mon, 04 Apr 2022 06:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649080659; cv=none; d=google.com; s=arc-20160816; b=mFOSicd0uBUA7k4Q818zZR7EP1XwHgwb3pID0Coi1io33IwE27CzvH4x5U/SjX+Dh4 xqeuebGr7sI7M9mNjz6g9P0QOv2Ie5K0iVs4sck62cbxMwQaAD1/f0RR/2sYoHd0zTt4 RUcIQQ6pebZHLrVwgPvHbY0R5VzkWwflzu54MJ9i4iN/v2XgxBKkt6aSLAqtsKFs3dbG Qy/d2vhCB/VyZxis03LhFX5Ja/B9hNKSFUHGzGcwZ2BHd56FpDggkbeWW9L7gPRl2jXm f6LuKYvTsh3MEX/8CVsx+5+pagC1oNH67Vz35zRQ36blMT4m9LJbVAeBo4Pv70FxSVHj gpnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AtTP2fBAxpBpKwFzWZifER3ajFtptBfCrxIJ/BLoV+c=; b=zbfiD7hhbAA+b1gNvW1lukY+CpHeeg5vALspGO+ItnZxPg/CohI874WhWfPoSZ1sqw LvQnf68BOyaWtiC7/+i2NJyC0iHB5TPMbWUgUNSCWnkXX+DBz8xfh7Feh/BVmaz38fwK mIIT6oIwrR0YFJJNZX0btRr5QiZnCh0dsHfLNzwUJXBXeqrk0plSqKMujJ81xWxB8hIZ ypZBFLnmYE7mKmD9X2GOYlYZZ/vWJsyhZKBfDULO4POvi306gErBAZT5yv1OAPRXAW+A nNvT9IoAL9CM8XyhsbA8qb8/GlBpi98+/1twBgSBDhZQAIiVMF5yJRvbG8rw/ZW55mU9 47pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UAq3M69A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv21-20020a170906b1d500b006df76385d3csi6644185ejb.476.2022.04.04.06.57.13; Mon, 04 Apr 2022 06:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=UAq3M69A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348894AbiDAOxe (ORCPT + 99 others); Fri, 1 Apr 2022 10:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348264AbiDAOdw (ORCPT ); Fri, 1 Apr 2022 10:33:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 221511EC997; Fri, 1 Apr 2022 07:31:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD7DB61CA5; Fri, 1 Apr 2022 14:31:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEB45C340F2; Fri, 1 Apr 2022 14:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648823495; bh=Y2Zxr5e0Iloj2IgaACLwbBRRdG5EG0uvi9BgSw9Din4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAq3M69ANrte0WQmbU7fVpAHKI4ToiQfULF/vLbqQpAXMjThldGROsLZCVv0RVQn4 gjJeiAeEMHGHB2+MegngdZhmmIZt8Nmm0R+gFd1bL3LXXPbokWjx4WWKg86vgUwdSG KCyG2oLqKM3V5kWBwJjrwb6Xwvi3nfqas4FOUg7IO68Ttj6AuZuUi7LjUldSUA30Ej kFCPxcdBoy55LJM2L+eXBpuAtIRNl/lM8516SpV1lUA6MUspJWEnr4Wi+vx4/Aaa+Z jZvuGrLojHALNBcDVJeWY3xok5AGrySHjSQX70bsS30vZyB0IQ8NWktTw398RetpmU 04DIXQnOlAlDw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Minghao Chi (CGEL ZTE)" , Zeal Robot , Marcel Holtmann , Sasha Levin , johan.hedberg@gmail.com, luiz.dentz@gmail.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 118/149] Bluetooth: use memset avoid memory leaks Date: Fri, 1 Apr 2022 10:25:05 -0400 Message-Id: <20220401142536.1948161-118-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220401142536.1948161-1-sashal@kernel.org> References: <20220401142536.1948161-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org From: "Minghao Chi (CGEL ZTE)" [ Upstream commit d3715b2333e9a21692ba16ef8645eda584a9515d ] Use memset to initialize structs to prevent memory leaks in l2cap_ecred_connect Reported-by: Zeal Robot Signed-off-by: Minghao Chi (CGEL ZTE) Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- 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 e817ff0607a0..8df99c07f272 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1436,6 +1436,7 @@ static void l2cap_ecred_connect(struct l2cap_chan *chan) l2cap_ecred_init(chan, 0); + memset(&data, 0, sizeof(data)); data.pdu.req.psm = chan->psm; data.pdu.req.mtu = cpu_to_le16(chan->imtu); data.pdu.req.mps = cpu_to_le16(chan->mps); -- 2.34.1