Skip to content

Commit 9a00e50

Browse files
author
Ming Lei
committed
block: flip iter directions in blk_rq_integrity_map_user()
JIRA: https://issues.redhat.com/browse/RHEL-102497 commit 43a67dd Author: Caleb Sander Mateos <csander@purestorage.com> Date: Tue Jun 3 12:47:51 2025 -0600 block: flip iter directions in blk_rq_integrity_map_user() blk_rq_integrity_map_user() creates the ubuf iter with ITER_DEST for write-direction operations and ITER_SOURCE for read-direction ones. This is backwards; writes use the user buffer as a source for metadata and reads use it as a destination. Switch to the rq_data_dir() helper, which maps writes to ITER_SOURCE (WRITE) and reads to ITER_DEST(READ). Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Fixes: fe8f4ca ("block: modify bio_integrity_map_user to accept iov_iter as argument") Link: https://lore.kernel.org/r/20250603184752.1185676-1-csander@purestorage.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent e67fe5a commit 9a00e50

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

block/blk-integrity.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,8 @@ int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf,
117117
{
118118
int ret;
119119
struct iov_iter iter;
120-
unsigned int direction;
121120

122-
if (op_is_write(req_op(rq)))
123-
direction = ITER_DEST;
124-
else
125-
direction = ITER_SOURCE;
126-
iov_iter_ubuf(&iter, direction, ubuf, bytes);
121+
iov_iter_ubuf(&iter, rq_data_dir(rq), ubuf, bytes);
127122
ret = bio_integrity_map_user(rq->bio, &iter);
128123
if (ret)
129124
return ret;

0 commit comments

Comments
 (0)