mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yingjie Wang <x-professor@outlook.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: "Martin K . Petersen" <mkp@kernel.org>,
	"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Jens Axboe <axboe@kernel.dk>, Yang Xiuwei <yangxiuwei@kylinos.cn>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yingjie Wang <x-professor@outlook.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: [PATCH v2 2/2] scsi: bsg: report io_uring data copyback failures
Date: Fri, 23 Oct 2026 16:23:06 +0000	[thread overview]
Message-ID: <0b35d2d46bf8ff9f2dbba83ae093d17351e950e9.1792772194.git.x-professor@outlook.com> (raw)
In-Reply-To: <cover.1792772194.git.x-professor@outlook.com>

scsi_bsg_uring_task_cb() discards the result of blk_rq_unmap_user(). For a
data-in command that uses a bounce buffer, the task work can therefore
post a CQE with res == 0 despite a copyback failure.

Use the unmap result as the CQE status. A later sense-buffer copy failure
continues to take precedence.

On x86_64, a raw BSG INQUIRY into an unaligned anonymous PROT_NONE
mapping posted a CQE with res == 0 in 20/20 runs before this change and
res == -EFAULT in 20/20 runs afterward. Writable controls succeeded in
20/20 runs on both kernels.

Fixes: 7b6d3255e7f8 ("scsi: bsg: add io_uring passthrough handler")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
---
 drivers/scsi/scsi_bsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_bsg.c b/drivers/scsi/scsi_bsg.c
index 37393a8dedd84..e4a65d7a23742 100644
--- a/drivers/scsi/scsi_bsg.c
+++ b/drivers/scsi/scsi_bsg.c
@@ -41,7 +41,7 @@ static void scsi_bsg_uring_task_cb(struct io_tw_req tw_req, io_tw_token_t tw)
 	u8 sense_len_wr = 0;
 
 	if (pdu->bio)
-		blk_rq_unmap_user(pdu->bio);
+		ret = blk_rq_unmap_user(pdu->bio);
 
 	if (scsi_status_is_check_condition(scmd->result)) {
 		driver_status = DRIVER_SENSE;
-- 
2.43.0


  parent reply	other threads:[~2026-10-23 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 16:23 [PATCH v2 0/2] scsi: bsg: report " Yingjie Wang
2026-10-23 16:23 ` [PATCH v2 1/2] scsi: bsg: report synchronous " Yingjie Wang
2026-10-23 16:23 ` Yingjie Wang [this message]
2026-10-26  1:06 ` [PATCH v2 0/2] scsi: bsg: report " Yang Xiuwei

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=0b35d2d46bf8ff9f2dbba83ae093d17351e950e9.1792772194.git.x-professor@outlook.com \
    --to=x-professor@outlook.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yangxiuwei@kylinos.cn \
    /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

all inboxes | Powered by JetHome®