Commit f01f527
ublk: snapshot batch commands before preparing I/O
The batch prepare path rereads its userspace element array when rolling
back a partially prepared batch. Userspace can change an already
processed tag before the second read, causing rollback to reject the
replacement tag and leave earlier I/O slots prepared. The
WARN_ON_ONCE() in the rollback path then fires.
Copy the bounded batch into kernel memory before changing any I/O state
and use the same snapshot for preparation and rollback. Commit and fetch
batches retain the existing chunked userspace walk.
Fixes: b256795 ("ublk: handle UBLK_U_IO_PREP_IO_CMDS")
Reported-by: syzbot+1a67ee1aa79484801ec6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1a67ee1aa79484801ec6
Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260630211827.50475-1-alhouseenyousef@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 1e56f30 commit f01f527
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3584 | 3584 | | |
3585 | 3585 | | |
3586 | 3586 | | |
| 3587 | + | |
3587 | 3588 | | |
3588 | 3589 | | |
3589 | 3590 | | |
| |||
3632 | 3633 | | |
3633 | 3634 | | |
3634 | 3635 | | |
3635 | | - | |
| 3636 | + | |
| 3637 | + | |
| 3638 | + | |
| 3639 | + | |
3636 | 3640 | | |
3637 | 3641 | | |
3638 | 3642 | | |
| |||
3723 | 3727 | | |
3724 | 3728 | | |
3725 | 3729 | | |
| 3730 | + | |
3726 | 3731 | | |
3727 | 3732 | | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
3728 | 3738 | | |
3729 | 3739 | | |
3730 | 3740 | | |
3731 | 3741 | | |
3732 | 3742 | | |
3733 | 3743 | | |
| 3744 | + | |
3734 | 3745 | | |
3735 | 3746 | | |
3736 | 3747 | | |
| |||
0 commit comments