public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Gopal Tiwari <gtiwari@redhat.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 09/26] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
Date: Wed, 24 Feb 2021 07:54:17 -0500	[thread overview]
Message-ID: <20210224125435.483539-9-sashal@kernel.org> (raw)
In-Reply-To: <20210224125435.483539-1-sashal@kernel.org>

From: Gopal Tiwari <gtiwari@redhat.com>

[ 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 <gtiwari@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/bluetooth/amp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 78bec8df8525b..72ef967c56630 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.27.0


  parent reply	other threads:[~2021-02-24 13:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 12:54 [PATCH AUTOSEL 4.19 01/26] staging: fwserial: Fix error handling in fwserial_create Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 02/26] x86/reboot: Add Zotac ZBOX CI327 nano PCI reboot quirk Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 03/26] vt/consolemap: do font sum unsigned Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 04/26] wlcore: Fix command execute failure 19 for wl12xx Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 05/26] Bluetooth: hci_h5: Set HCI_QUIRK_SIMULTANEOUS_DISCOVERY for btrtl Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 06/26] pktgen: fix misuse of BUG_ON() in pktgen_thread_worker() Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 07/26] ath10k: fix wmi mgmt tx queue full due to race condition Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 08/26] x86/build: Treat R_386_PLT32 relocation as R_386_PC32 Sasha Levin
2021-02-24 12:54 ` Sasha Levin [this message]
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 10/26] staging: most: sound: add sanity check for function argument Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 11/26] udlfb: Fix memory leak in dlfb_usb_probe Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 12/26] crypto: tcrypt - avoid signed overflow in byte count Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 13/26] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 14/26] drm/amd/display: Guard against NULL pointer deref when get_i2c_info fails Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 15/26] media: mceusb: sanity check for prescaler value Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 16/26] media: uvcvideo: Allow entities with no pads Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 17/26] f2fs: handle unallocated section and zone on pinned/atgc Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 18/26] f2fs: fix to set/clear I_LINKABLE under i_lock Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 19/26] tomoyo: ignore data race while checking quota Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 20/26] smackfs: restrict bytes count in smackfs write functions Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 21/26] Drivers: hv: vmbus: Resolve race condition in vmbus_onoffer_rescind() Sasha Levin
2021-02-24 13:21   ` Andrea Parri
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 22/26] btrfs: fix error handling in commit_fs_roots Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 23/26] parisc: Bump 64-bit IRQ stack size to 64 KB Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 24/26] ASoC: Intel: bytcr_rt5640: Add quirk for the Estar Beauty HD MID 7316R tablet Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 25/26] ASoC: Intel: bytcr_rt5640: Add quirk for the Voyo Winpad A15 tablet Sasha Levin
2021-02-24 12:54 ` [PATCH AUTOSEL 4.19 26/26] ASoC: Intel: bytcr_rt5640: Add quirk for the Acer One S1002 tablet Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224125435.483539-9-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=gtiwari@redhat.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox