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 09A6AC43217 for ; Tue, 8 Nov 2022 14:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235308AbiKHOOK (ORCPT ); Tue, 8 Nov 2022 09:14:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235315AbiKHOOJ (ORCPT ); Tue, 8 Nov 2022 09:14:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 462AEC767 for ; Tue, 8 Nov 2022 06:14:08 -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 D79C46157D for ; Tue, 8 Nov 2022 14:14:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB2D5C433C1; Tue, 8 Nov 2022 14:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667916847; bh=Ddhz+ngOVwmUhE1diduM5r6B8mm3Sh2vfAmqrtB91EI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Us4NzS4P1/G7AwNOyuT04DutoWDQTI14VZ9sUSGWAvOfEZRla1xv8T6sdbVwKCLVA 3Nf4P2PTRJN8r1d52HfzPIOdCz5QY/jMzrQCpdSvgHlH6vC6ib1f/au5yT7Nd7AxDy IUEepcS6sJ4Un54r1Ev/uffWh3f2NS8YXiFmzDN0= 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 6.0 123/197] Bluetooth: L2CAP: Fix attempting to access uninitialized memory Date: Tue, 8 Nov 2022 14:39:21 +0100 Message-Id: <20221108133400.577239931@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108133354.787209461@linuxfoundation.org> References: <20221108133354.787209461@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 @@ -3764,7 +3764,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);