From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B51C46467 for ; Tue, 12 Apr 2022 07:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352253AbiDLHXo (ORCPT ); Tue, 12 Apr 2022 03:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353910AbiDLHQg (ORCPT ); Tue, 12 Apr 2022 03:16:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F7E641FAB; Mon, 11 Apr 2022 23:57:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id 351A1B81B35; Tue, 12 Apr 2022 06:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99577C385A1; Tue, 12 Apr 2022 06:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649746661; bh=CV2aH48awvbFROFb5h94Dla8Uev5LAWjTvKVsxP/fSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pO2c9yErGH5yxb3Ukwwdk63W5FlItQC4vbfEBu+fEq5zyMS+j5ekqDVGQPQ3CGwrM Vb5eqEq6X+hyOJjukiEsRNf101VCa2Gdbo2VF/pAvq0IsHJeHPvWG7QJ02nsaecopS Lwb6AsFZGyRTnHLWNPbgosz+gUWBEjtqARwQWCEo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , "Minghao Chi (CGEL ZTE)" , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.16 086/285] Bluetooth: use memset avoid memory leaks Date: Tue, 12 Apr 2022 08:29:03 +0200 Message-Id: <20220412062946.146360048@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062943.670770901@linuxfoundation.org> References: <20220412062943.670770901@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@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 4f8f37599962..e06baffc0dc6 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.35.1