From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 649AD4FE2F2; Wed, 30 Sep 2026 15:40:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790782829; cv=none; b=i7TXYzFvGbN4n+fMNT84OmyhkNFjAcGWqDHiYs2XF403czng87jbkFwOevg9xXfvI46Saz+95B+kNiu/07Qxbzv4FwEszPCnbRLDOynD2LSDW10DRm8G3cNZmiFxLYkVzY/GIxpP53t/zu5ebHZxtxi/aNLwUSB7zh8A+jnhwho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790782829; c=relaxed/simple; bh=r5s37eta114hRQopElvf10guZnUwNBhLCzKMWUkwEbo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YPU3C/2xhAqYw+VQugOO8qAeGFEd8S1cBvcV+LIBfO8zYcaCI3gwai7jnEvLHMduzqnhUMUIijeCGMLxe+Z4h45mu8G4ADq+MJYS5+V3TpMfBz82RAdGAtf/SDxeF3TS6Q5PC81XWicBEF5WmPYG64Ndlwdk945cjpC4T0iPXQM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=X94YnfCe; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="X94YnfCe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD5011F00893; Wed, 30 Sep 2026 15:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790782823; bh=ybprl5qjBDMkTxhpvam3FXyzXLvw2he18Mslz4KsNNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=X94YnfCeBZDf7aolvw+l9LVzimwapDwOitIBtUpy/2orjP6Qxf70D3NiNnK7GY67z wFIS6uXc2ztlzKLUePCtMpOk3cg0HW6YW9ypRyYMA7ATsDRhHg03fh78L4y/vWf4Xw BGsayF7CqBuQDL+/mg2b4ExIQlIMYDstE0wrD7Vw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jia Jia , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.10 182/595] vhost-scsi: flush backend after device ioctls Date: Wed, 30 Sep 2026 17:21:15 +0200 Message-ID: <20260930152351.655442646@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152347.700140858@linuxfoundation.org> References: <20260930152347.700140858@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jia Jia [ Upstream commit 22598f55a4c2b510b3df5e69e563387a963222ae ] vhost-scsi translates guest response descriptors into userspace iovecs when commands are submitted. Target-core completes those commands asynchronously, so VHOST_SET_MEM_TABLE can replace the memory table while an in-flight command still retains response iovecs translated through the old table. If the old mapping is reused after VHOST_SET_MEM_TABLE returns, command completion can write the response to an unrelated userspace object. Flush the vhost-scsi backend after vhost_dev_ioctl() handles a device ioctl. This waits for in-flight commands that can still use the old response iovecs before the ioctl returns. Signed-off-by: Jia Jia Signed-off-by: Michael S. Tsirkin Message-ID: <20260724060919.1569170-1-physicalmtea@gmail.com> Signed-off-by: Sasha Levin --- drivers/vhost/scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index ec9691f6594d1..3b15955751fa2 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1937,9 +1937,10 @@ vhost_scsi_ioctl(struct file *f, default: mutex_lock(&vs->dev.mutex); r = vhost_dev_ioctl(&vs->dev, ioctl, argp); - /* TODO: flush backend after dev ioctl. */ if (r == -ENOIOCTLCMD) r = vhost_vring_ioctl(&vs->dev, ioctl, argp); + else + vhost_scsi_flush(vs); mutex_unlock(&vs->dev.mutex); return r; } -- 2.53.0