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 D3786C4332F for ; Tue, 8 Nov 2022 13:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234795AbiKHNzo (ORCPT ); Tue, 8 Nov 2022 08:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234804AbiKHNzn (ORCPT ); Tue, 8 Nov 2022 08:55:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A081365E48 for ; Tue, 8 Nov 2022 05:55:42 -0800 (PST) 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 3D26A6130A for ; Tue, 8 Nov 2022 13:55:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A8D5C433C1; Tue, 8 Nov 2022 13:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667915741; bh=/Ld49mFKtOLhBM4mFfSgci/2Wpz5Aox9sGuwa7SDw5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRyVsEBaaakMQFDpf8yFQK1G6OoJbnWQzZeoujWjuPhh/hqJCMWdlVHIRDOk2GChw 4NrjN72E7eA/avU4OJemvdTxOGuRL+OxBfqAlXLHKwqyRN78tFpQ9BoSm9/VE48jsZ apmCwk2LeOPy3TrSaEP8gQcHstyxgc/+f/bdD3/I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Tam=C3=A1s=20Koczka?= , Luiz Augusto von Dentz , Tedd Ho-Jeong An Subject: [PATCH 5.10 077/118] Bluetooth: L2CAP: Fix attempting to access uninitialized memory Date: Tue, 8 Nov 2022 14:39:15 +0100 Message-Id: <20221108133344.077648453@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108133340.718216105@linuxfoundation.org> References: <20221108133340.718216105@linuxfoundation.org> User-Agent: quilt/0.67 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: Luiz Augusto von Dentz commit b1a2cd50c0357f243b7435a732b4e62ba3157a2e upstream. On l2cap_parse_conf_req the variable efs is only initialized if remote_efs has been set. CVE: CVE-2022-42895 CC: stable@vger.kernel.org Reported-by: Tamás Koczka Signed-off-by: Luiz Augusto von Dentz Reviewed-by: Tedd Ho-Jeong An Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/l2cap_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -3760,7 +3760,8 @@ done: l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), (unsigned long) &rfc, endptr - ptr); - if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) { + if (remote_efs && + test_bit(FLAG_EFS_ENABLE, &chan->flags)) { chan->remote_id = efs.id; chan->remote_stype = efs.stype; chan->remote_msdu = le16_to_cpu(efs.msdu);