Skip to content
Commit 13f3956e authored by Christian A. Ehrhardt's avatar Christian A. Ehrhardt Committed by Jens Axboe
Browse files

block: Fix WARNING in _copy_from_iter



Syzkaller reports a warning in _copy_from_iter because an
iov_iter is supposedly used in the wrong direction. The reason
is that syzcaller managed to generate a request with
a transfer direction of SG_DXFER_TO_FROM_DEV. This instructs
the kernel to copy user buffers into the kernel, read into
the copied buffers and then copy the data back to user space.

Thus the iovec is used in both directions.

Detect this situation in the block layer and construct a new
iterator with the correct direction for the copy-in.

Reported-by: default avatar <syzbot+a532b03fdfee2c137666@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/lkml/0000000000009b92c10604d7a5e9@google.com/t/


Reported-by: default avatar <syzbot+63dec323ac56c28e644f@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/lkml/0000000000003faaa105f6e7c658@google.com/T/


Signed-off-by: default avatarChristian A. Ehrhardt <lk@c--e.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240121202634.275068-1-lk@c--e.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7777f47f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment