ublk_drv: update iod->addr for UBLK_IO_NEED_GET_DATA
authorZiyangZhang <ZiyangZhang@linux.alibaba.com>
Wed, 10 Aug 2022 05:52:12 +0000 (13:52 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 13 Aug 2022 14:35:28 +0000 (08:35 -0600)
commit92cb6e2e5dbaea02c2fa317f3543c8918db25e89
treef53af683fc1277fa9a3c56d8ca660a19ade4bea8
parentaa0c680c3aa96a5f9f160d90dd95402ad578e2b0
ublk_drv: update iod->addr for UBLK_IO_NEED_GET_DATA

If ublksrv sends UBLK_IO_NEED_GET_DATA with new allocated io buffer, we
have to update iod->addr in task_work before calling io_uring_cmd_done().
Then usersapce target can handle (write)io request with the new io
buffer reading from updated iod.

Without this change, userspace target may touch a wrong io buffer!

Signed-off-by: ZiyangZhang <ZiyangZhang@linux.alibaba.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220810055212.66417-1-ZiyangZhang@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c