Skip to contentSkip to conversation

io_uring: fix off-by one bvec index

PATCH Applied Keith Busch 2 participants 3 messages Nov 20, 2023 – Nov 21, 2023 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix off-by one bvec index

From: Keith Busch <[email protected]>

If the offset equals the bv_len of the first registered bvec, then the request does not include any of that first bvec. Skip it so that drivers don't have to deal with a zero length bvec, which was observed to break NVMe's PRP list creation.

---
 io_uring/rsrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/rsrc.c +1 -1
index 7034be555334d..f521c5965a933 100644
@@ -1258,7 +1258,7 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
 		 */
 		const struct bio_vec *bvec = imu->bvec;
 
-		if (offset <= bvec->bv_len) {
+		if (offset < bvec->bv_len) {
 			/*
 			 * Note, huge pages buffers consists of one large
 			 * bvec entry and should always go this way. The other
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 6 lines · Keith Busch

From: Keith Busch <[email protected]>

If the offset equals the bv_len of the first registered bvec, then the request does not include any of that first bvec. Skip it so that drivers don't have to deal with a zero length bvec, which was observed to break NVMe's PRP list creation.

Thanks Keith, that was fast (I sent in the report...). I applied this with a fixes and stable tag.

Signature · 1 line
Jens Axboe
maintainer Applied
#2 lore raw
In reply to Keith Busch
Quoted 6 lines · Keith Busch

If the offset equals the bv_len of the first registered bvec, then the request does not include any of that first bvec. Skip it so that drivers don't have to deal with a zero length bvec, which was observed to break NVMe's PRP list creation.

Applied, thanks!

[1/1] io_uring: fix off-by one bvec index

      commit: d6fef34ee4d102be448146f24caf96d7b4a05401

Best regards,

Signature · 1 line
Jens Axboe