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 CE640C4332F for ; Tue, 8 Nov 2022 13:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234578AbiKHNrZ (ORCPT ); Tue, 8 Nov 2022 08:47:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234562AbiKHNrY (ORCPT ); Tue, 8 Nov 2022 08:47:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 101B75986B for ; Tue, 8 Nov 2022 05:47:24 -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 A171A61528 for ; Tue, 8 Nov 2022 13:47:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7346CC4347C; Tue, 8 Nov 2022 13:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667915243; bh=tyIC0wcs6zPNRtp6ePZpHvT/LTfKctnrsaUe1ftP+po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwrbOhAbaMaWfHqUbi7H87EQQdT1mED55TYvuh+R4OgCJRouccjdMtcyLppEfZYdD f52WzKTWpnfEeFhTiMhhCY8zrnI/Kvt7YQ4DvhrR+BD/GQEN5kieg+6Ft/eEln0Rxg 66LUlmN3rTnxpkqgCjzt9ejTS2GInuX2z5aWphyo= 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 4.19 30/48] Bluetooth: L2CAP: Fix attempting to access uninitialized memory Date: Tue, 8 Nov 2022 14:39:15 +0100 Message-Id: <20221108133330.588041675@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108133329.533809494@linuxfoundation.org> References: <20221108133329.533809494@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 @@ -3551,7 +3551,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);