stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Prabhath Sajeepa <psajeepa@purestorage.com>,
	Roland Dreier <roland@purestorage.com>,
	Max Gurtovoy <maxg@mellanox.com>, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>, Sasha Levin <sashal@kernel.org>,
	linux-nvme@lists.infradead.org
Subject: [PATCH AUTOSEL 5.5 03/28] nvme-rdma: Avoid double freeing of async event data
Date: Thu, 26 Mar 2020 19:23:32 -0400	[thread overview]
Message-ID: <20200326232357.7516-3-sashal@kernel.org> (raw)
In-Reply-To: <20200326232357.7516-1-sashal@kernel.org>

From: Prabhath Sajeepa <psajeepa@purestorage.com>

[ Upstream commit 9134ae2a2546cb96abddcd4469a79c77ee3a4480 ]

The timeout of identify cmd, which is invoked as part of admin queue
creation, can result in freeing of async event data both in
nvme_rdma_timeout handler and error handling path of
nvme_rdma_configure_admin queue thus causing NULL pointer reference.
Call Trace:
 ? nvme_rdma_setup_ctrl+0x223/0x800 [nvme_rdma]
 nvme_rdma_create_ctrl+0x2ba/0x3f7 [nvme_rdma]
 nvmf_dev_write+0xa54/0xcc6 [nvme_fabrics]
 __vfs_write+0x1b/0x40
 vfs_write+0xb2/0x1b0
 ksys_write+0x61/0xd0
 __x64_sys_write+0x1a/0x20
 do_syscall_64+0x60/0x1e0
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Reviewed-by: Roland Dreier <roland@purestorage.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Prabhath Sajeepa <psajeepa@purestorage.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/rdma.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 3e85c5cacefd2..0fe08c4dfd2f1 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -850,9 +850,11 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
 	if (new)
 		blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
 out_free_async_qe:
-	nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
-		sizeof(struct nvme_command), DMA_TO_DEVICE);
-	ctrl->async_event_sqe.data = NULL;
+	if (ctrl->async_event_sqe.data) {
+		nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
+			sizeof(struct nvme_command), DMA_TO_DEVICE);
+		ctrl->async_event_sqe.data = NULL;
+	}
 out_free_queue:
 	nvme_rdma_free_queue(&ctrl->queues[0]);
 	return error;
-- 
2.20.1


  parent reply	other threads:[~2020-03-26 23:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 23:23 [PATCH AUTOSEL 5.5 01/28] thunderbolt: Fix error code in tb_port_is_width_supported() Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 02/28] drm/bridge: dw-hdmi: fix AVI frame colorimetry Sasha Levin
2020-03-26 23:23 ` Sasha Levin [this message]
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 04/28] ALSA: hda/realtek: Fix pop noise on ALC225 Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 05/28] staging: wfx: fix warning about freeing in-use mutex during device unregister Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 06/28] kconfig: introduce m32-flag and m64-flag Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 07/28] int128: fix __uint128_t compiler test in Kconfig Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 08/28] drm/amdgpu: add fbdev suspend/resume on gpu reset Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 09/28] drm/amd/display: Add link_rate quirk for Apple 15" MBP 2017 Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 10/28] drm/bochs: downgrade pci_request_region failure from error to warning Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 11/28] initramfs: restore default compression behavior Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 12/28] staging: greybus: loopback_test: fix potential path truncation Sasha Levin
2020-03-27  6:28   ` Greg KH
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 13/28] staging: greybus: loopback_test: fix potential path truncations Sasha Levin
2020-03-27  6:28   ` Greg Kroah-Hartman
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 14/28] arm64: smp: fix smp_send_stop() behaviour Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 15/28] arm64: smp: fix crash_smp_send_stop() behaviour Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 16/28] modpost: Get proper section index by get_secindex() instead of st_shndx Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 17/28] drm/amdgpu: fix typo for vcn1 idle check Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 18/28] tools/power turbostat: Fix gcc build warnings Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 19/28] tools/power turbostat: Fix missing SYS_LPI counter on some Chromebooks Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 20/28] tools/power turbostat: Fix 32-bit capabilities warning Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 21/28] nvmet-tcp: set MSG_MORE only if we actually have more to send Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 22/28] btrfs: fix removal of raid[56|1c34} incompat flags after removing block group Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 23/28] kconfig: Add yes2modconfig and mod2yesconfig targets Sasha Levin
2020-03-26 23:41   ` Tetsuo Handa
2020-03-27  6:26   ` Greg KH
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 24/28] ALSA: pcm: oss: Avoid plugin buffer overflow Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 25/28] ALSA: line6: Fix endless MIDI read loop Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 26/28] ALSA: pcm: oss: Remove WARNING from snd_pcm_plug_alloc() checks Sasha Levin
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 27/28] tty: fix compat TIOCGSERIAL leaking uninitialized memory Sasha Levin
2020-03-27  6:27   ` Greg KH
2020-03-26 23:23 ` [PATCH AUTOSEL 5.5 28/28] drm/lease: fix WARNING in idr_destroy 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=20200326232357.7516-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=psajeepa@purestorage.com \
    --cc=roland@purestorage.com \
    --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;
as well as URLs for NNTP newsgroup(s).