Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979657pxb; Fri, 5 Mar 2021 04:40:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxq9DgvbHz50cyGhKb6Pq6idyxIJRjhqQEW+VkMe6dpCq1vMJKd/RGxSLkv7jIwY0YR0Cjg X-Received: by 2002:aa7:cf02:: with SMTP id a2mr8746922edy.59.1614948012895; Fri, 05 Mar 2021 04:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614948012; cv=none; d=google.com; s=arc-20160816; b=v/+zCTZMWVCQWWKYw5+u6YX5UCExB7qOFDFJYCPsLYfWZYJAoTkUd7+kx+O/UpVqi4 vW/cpbJiLz0Ju/5EovajMigRw4Q559LvnaGDORe8AfGMlzBcSiEWDtknKTH9tj0mTrDC WW+Fcn0zUlbkuVEqiXllaUCsmfjq61X6dOAeEFyPoej0r/Pr3VbWZyWZtom6rjcG6JPU WSyh1EZ/RQvqlL4bHsafdRHCiLYGodMsLlSlysS7G9INSJLZ2KaE2rU49Cfv6vWsXtIs ArCQNo7aLbbco6q2Qfq8y5LLWsjDRGK94lYTXlzgIp652UIitEWLNX/GOOYrmIVx1Oid eo0A== 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=y/8FBwvPELHoEYvPT/noIiwp8/DMdxcVFSCChnQeuzQ=; b=NzQM3VE2FyTALEK4o1Ysut9ZJ6i2uTm2pmH6KcjZAIr7ta4cR1kiICqEgGBRpIkKl5 uTrQV+yepQxu7Qvfe07+sikxwjOkHQwF91yWm0Q4uSiKzi4ajLlxJPwj1vs6Lbr0P6Qm Epwk0rcC11effZn1/KML48lYRETIkFcmU9kbLg7DL2izggPJUwraQ3EvNfO4Akm/qMgk O/KZNS4BktBjxS92TcMRguThACTkzi/Z35QIxAVm2xzTZm9tL25NJscSCRkofLXMlGbL AwJ0C4+iLGb5iI1iSNzfZUQ4EuhOU6+87ZaditoxSAoewipuDVBlphUtm959e2b/JjEq MLbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QeS1Atm4; 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 w14si1566865ede.222.2021.03.05.04.39.49; Fri, 05 Mar 2021 04:40:12 -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=QeS1Atm4; 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 S232781AbhCEMiy (ORCPT + 99 others); Fri, 5 Mar 2021 07:38:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:51150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbhCEMiF (ORCPT ); Fri, 5 Mar 2021 07:38:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F40165004; Fri, 5 Mar 2021 12:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947884; bh=Geub5W0qjDejt7n5V49PH7B06lWTQwWGnYyqByd3hrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QeS1Atm4ctU9JXxCRA3r6xFxTMJvh0OhRfXgwPhaP107P+QXuC7ok8b/2ET0QBb/A TeqBSlcuYA+lGqnNVvGbHY5dILRobi6RdmHVTadwojp9ZpWcnbAhgcklsd00k5Aos0 xdvZDuyBTpnDBEtJ5ZrPMXtcTfonDfDMspfNwG6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gopal Tiwari , Marcel Holtmann , Sasha Levin Subject: [PATCH 4.19 29/52] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data Date: Fri, 5 Mar 2021 13:22:00 +0100 Message-Id: <20210305120855.108407395@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@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: Gopal Tiwari [ Upstream commit e8bd76ede155fd54d8c41d045dda43cd3174d506 ] kernel panic trace looks like: #5 [ffffb9e08698fc80] do_page_fault at ffffffffb666e0d7 #6 [ffffb9e08698fcb0] page_fault at ffffffffb70010fe [exception RIP: amp_read_loc_assoc_final_data+63] RIP: ffffffffc06ab54f RSP: ffffb9e08698fd68 RFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8c8845a5a000 RCX: 0000000000000004 RDX: 0000000000000000 RSI: ffff8c8b9153d000 RDI: ffff8c8845a5a000 RBP: ffffb9e08698fe40 R8: 00000000000330e0 R9: ffffffffc0675c94 R10: ffffb9e08698fe58 R11: 0000000000000001 R12: ffff8c8b9cbf6200 R13: 0000000000000000 R14: 0000000000000000 R15: ffff8c8b2026da0b ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #7 [ffffb9e08698fda8] hci_event_packet at ffffffffc0676904 [bluetooth] #8 [ffffb9e08698fe50] hci_rx_work at ffffffffc06629ac [bluetooth] #9 [ffffb9e08698fe98] process_one_work at ffffffffb66f95e7 hcon->amp_mgr seems NULL triggered kernel panic in following line inside function amp_read_loc_assoc_final_data set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state); Fixed by checking NULL for mgr. Signed-off-by: Gopal Tiwari Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/amp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 78bec8df8525..72ef967c5663 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c @@ -305,6 +305,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev, struct hci_request req; int err; + if (!mgr) + return; + cp.phy_handle = hcon->handle; cp.len_so_far = cpu_to_le16(0); cp.max_len = cpu_to_le16(hdev->amp_assoc_size); -- 2.30.1