From: Yingjie Wang <x-professor@outlook.com>
To: "Martin K . Petersen" <mkp@kernel.org>,
"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Bart Van Assche <bvanassche@acm.org>,
Yang Xiuwei <yangxiuwei@kylinos.cn>, Jens Axboe <axboe@kernel.dk>,
"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: [PATCH v2 3/6] scsi: sr: release CDDA request before user copyback
Date: Mon, 26 Oct 2026 08:29:36 +0000 [thread overview]
Message-ID: <2cdd629d5bfe284041f3410391154821c19fdcf4.1793003363.git.x-professor@outlook.com> (raw)
In-Reply-To: <cover.1793003363.git.x-professor@outlook.com>
From: Yingjie Wang <x-professor@outlook.com>
sr_read_cdda_bpc() retains its completed request while unmapping the user
buffer. For a bounced data-in mapping, unmapping can copy to userspace
and fault. A fault that needs I/O from the same queue cannot progress if
the completed request retains the available tag.
Release the request after consuming its command result and sense data,
before unmapping the original BIO chain saved at submission. No request
or SCSI command field is accessed after the release. The mapping's BIO
references remain owned by blk_rq_unmap_user().
The scsi-mq request pool introduced this tag dependency. The later move
of the CDDA implementation from drivers/cdrom into sr was a relocation.
Fixes: d285203cf647 ("scsi: add support for a blk-mq based I/O path.")
Link: https://lore.kernel.org/r/20261022.scsi-cdda-lifetime.8f31a2c97b42@outlook.com
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
---
drivers/scsi/sr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 4f2e8d1be6da8..c64c25e9f4047 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -969,8 +969,11 @@ static int sr_read_cdda_bpc(struct cdrom_device_info *cdi, void __user *ubuf,
ret = -EIO;
}
+ blk_mq_free_request(rq);
if (blk_rq_unmap_user(bio))
ret = -EFAULT;
+ return ret;
+
out_put_request:
blk_mq_free_request(rq);
return ret;
--
2.43.0
next prev parent reply other threads:[~2026-10-26 8:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 8:29 [PATCH v2 0/6] scsi: release completed passthrough requests " Yingjie Wang
2026-10-26 8:29 ` [PATCH v2 1/6] scsi: core: release SG_IO request " Yingjie Wang
2026-10-26 8:29 ` [PATCH v2 2/6] scsi: core: release legacy ioctl " Yingjie Wang
2026-10-26 8:29 ` Yingjie Wang [this message]
2026-10-26 8:29 ` [PATCH v2 4/6] scsi: bsg: release synchronous " Yingjie Wang
2026-10-26 8:29 ` [PATCH v2 5/6] scsi: bsg: clear io_uring sense length on copy failure Yingjie Wang
2026-10-26 9:40 ` Yang Xiuwei
2026-10-26 8:29 ` [PATCH v2 6/6] scsi: bsg: release io_uring requests in end-I/O Yingjie Wang
2026-10-26 9:40 ` Yang Xiuwei
2026-10-27 9:35 ` Yang Xiuwei
2026-10-26 15:56 ` Bart Van Assche
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=2cdd629d5bfe284041f3410391154821c19fdcf4.1793003363.git.x-professor@outlook.com \
--to=x-professor@outlook.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=io-uring@vger.kernel.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®