Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9286879pxu; Mon, 28 Dec 2020 11:26:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyWG1OkN69mIP8EYacWyhf5lWy6gqkCEs9jO+8pVIXeEJl9x3QkCUz/dIKNNfh0WcuwnX/ X-Received: by 2002:a50:8387:: with SMTP id 7mr41927640edi.131.1609183607390; Mon, 28 Dec 2020 11:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609183607; cv=none; d=google.com; s=arc-20160816; b=eKSFwXlcZjMugmerCGoUSGxeHjdTrvMKceNF/5FjPgEiwvldDPhZdus53FSLhnIcgJ xRXLIrDyNATsG7m3u1HYOlpioYS5/DsGs98fqVDExwneNnkqk6D7LnBDXfKARC1wXOsn bgl0Ee+bIgjrc+vaQKaxLl6gmX0N0YS7vULPJdBd/Z7iOjbnP7wZzIdRqRDoriAC44+Z fovx1ijoK66dS5E2Rar3kWfu8VJfQGmwc+vQPTV0KKk1B9rMPhrm+Ce5AmHsWEV9Jkpq qEBzky/915SGRDYwY+1mSHEJBov6/foBoQuHVb4uOU0J3dqxEsf+ry24+bYVZDYesZXb SIrQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lktc5d5YwJDepRxPwAZcySw6xK4l4JTLCzRuFN3Q+Xw=; b=MVo+y14OKOQxV/lOSnW6xUqwyvbJh3Vywo7aXXMWFmwiBIZk96bet7K0JJLka+rhmU tC+M0v3ytTXdiJNbHFu6COgsfRnDh6yel8/e71x8y5YoIaacgCwiqrhRjo5g4DGShhZu Sp+xR0vC8qClcmgYSYYniQg9jpptwijfyJ9kc6N7Wg+pW4GzufcJkxtALwxUM3+c+tzb ObMfv61tjquVfMFS/QRwjoXY1+moWC2Mze12tH09+Ml6pJfSr4mN50HU99Jti9axqE9B PoYtwrmfuOYs9pJ+MeH3OlZqDSM76tveOgfmTDfog9xpp+XAeJ8DKfa2jb5J+LTqtGKa 78qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wqQp9Qhr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb26si18580025ejb.487.2020.12.28.11.26.25; Mon, 28 Dec 2020 11:26:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wqQp9Qhr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436928AbgL1OCj (ORCPT + 99 others); Mon, 28 Dec 2020 09:02:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:34824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436872AbgL1OCb (ORCPT ); Mon, 28 Dec 2020 09:02:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61FE8207A9; Mon, 28 Dec 2020 14:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164135; bh=PekHwAJqcVsSADWvtwC6l+Hakrn8if+F0G1XZ4Ut9BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqQp9QhrR7QTVgnf/Zbr0nAR/ALBUW8EMyiC/34k+4GgArO4K1X7iCiwHTYAjyX9A Zs4QalWrmXn9QHL0T+zayo4JEXzktkbR1CFD5Ow4hfxUz7aFHpONNPs/8U8NIgSlii mHFWVJhspkDiOhZuCfDXq/rgSbQljzuS0af1yEfo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anmol Karn , Marcel Holtmann , Sasha Levin , syzbot+0bef568258653cff272f@syzkaller.appspotmail.com Subject: [PATCH 5.10 072/717] Bluetooth: Fix null pointer dereference in hci_event_packet() Date: Mon, 28 Dec 2020 13:41:10 +0100 Message-Id: <20201228125024.442839534@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: linux-kernel@vger.kernel.org From: Anmol Karn [ Upstream commit 6dfccd13db2ff2b709ef60a50163925d477549aa ] AMP_MGR is getting derefernced in hci_phy_link_complete_evt(), when called from hci_event_packet() and there is a possibility, that hcon->amp_mgr may not be found when accessing after initialization of hcon. - net/bluetooth/hci_event.c:4945 The bug seems to get triggered in this line: bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon; Fix it by adding a NULL check for the hcon->amp_mgr before checking the ev-status. Fixes: d5e911928bd8 ("Bluetooth: AMP: Process Physical Link Complete evt") Reported-and-tested-by: syzbot+0bef568258653cff272f@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=0bef568258653cff272f Signed-off-by: Anmol Karn Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index cbdf2a5559754..17a72695865b5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4941,6 +4941,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev, return; } + if (!hcon->amp_mgr) { + hci_dev_unlock(hdev); + return; + } + if (ev->status) { hci_conn_del(hcon); hci_dev_unlock(hdev); -- 2.27.0