Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9173669pxu; Mon, 28 Dec 2020 08:24:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNglLFPQXIPlkG0rkwSnfS8SlPojg/q78bPIEIop0FA7gqxAjQc/jjSx5F81ux4pchnEZc X-Received: by 2002:a17:906:9382:: with SMTP id l2mr3212422ejx.162.1609172661928; Mon, 28 Dec 2020 08:24:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172661; cv=none; d=google.com; s=arc-20160816; b=BD+WttEg9wuBLPOtnoArjBqrLcSTrc1HhQErQsvD5k+izHS8UsI8vYxLO0qWCqTjms OpuC7O7rjc7N6o2tX2pEIVEHgEyjadxVuyfy8bvvS36lmzsy+lSgc2KjR5s7dhi2l+oK NkCzuWiORa9yTCnbRaN6BfF34ZwuYYWJqupTGTC4Qa3KVLi3AHBA55qnOIH767Dzspt1 vQOKv+Gt2z+yl+hg8iyFtUDdIJ1H6goM765yXKd5Lhbmfg560EAjmomHDD+Txg611mw+ Pw6GlHcVMhtQ+91fgSuCwu4NHAfA/IN8cXr7jvTOZy7/hXrJXXjlQ6BXxebcrIWHS2+U sd8Q== 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=pYD0Iw2tqgikLpZ0s6SBiiaJkReiKDyuxCDDZ9yWQTQ=; b=Nr1DaNGNpPG24ss7wxBJREMM+3HsA6lKXKFqd8kde+grZsqIsZe9ZG5lZVrqCQzAtd DswmCN1UXINT+PpsojrZSMsw/qizz0nBxmp6L4EJbsHhBvVKbXkvby4t31cAmr1NM6p+ VkPtKXpT/czkwECQ19PESPZKmOabAejo2B9IclvZ3CgUdqvpYhfqBPNNGHEVeg71z5qp ExjaGEu5ArKU6sWW4Obri9XFwTaeGQ7KVXqPjI7IdXOEM8zOxgvaax2zQoT2cxqEaL6k Nhea5cik+2TKFfBFYbIFIg4/Y/A85Ru1rVuewQwdybtTRr4pijVJ63vGI1i2uKT/rXlC Sn6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/aUuZBh"; 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 fy24si18646147ejb.348.2020.12.28.08.23.57; Mon, 28 Dec 2020 08:24:21 -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="D/aUuZBh"; 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 S2387870AbgL1QWD (ORCPT + 99 others); Mon, 28 Dec 2020 11:22:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:39688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732024AbgL1NMV (ORCPT ); Mon, 28 Dec 2020 08:12:21 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9F11B2076D; Mon, 28 Dec 2020 13:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161126; bh=98j60LUhmHB494svGp885uJNy9G2/CW/lflLT5Rejug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/aUuZBhd2RjE4n2QHORlKzxMZO7ixNrLruyvnIGb5Dx27RsUtH/ArrYtW+CKdciB AOa0gKLn1w5b61A3UmZajJMeW6OMNEm6ceW9yoOTXPXa72PlMjCIAtgP7pJB8z1xvj M16fxl4rDuWbqcbm+8Qm/nZUgAo0cYobJMFDm9/E= 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 4.14 080/242] Bluetooth: Fix null pointer dereference in hci_event_packet() Date: Mon, 28 Dec 2020 13:48:05 +0100 Message-Id: <20201228124908.628189007@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 0db218b14bf3c..5e05a96e0646a 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4350,6 +4350,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