]> git.baikalelectronics.ru Git - kernel.git/commit
ublk: read any SQE values upfront
authorJens Axboe <axboe@kernel.dk>
Thu, 6 Apr 2023 02:00:46 +0000 (20:00 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Apr 2023 14:55:35 +0000 (16:55 +0200)
commitc9dc1d53c31c85b01fe422674383be6bdad33b18
treecb6b752abf29884c8653b0671ee2be4b66b8782d
parent48fc8b3076d835a2d6ca8048587388210d9fc524
ublk: read any SQE values upfront

commit 8c68ae3b22fa6fb2dbe83ef955ff10936503d28e upstream.

Since SQE memory is shared with userspace, we should only be reading it
once. We cannot read it multiple times, particularly when it's read once
for validation and then read again for the actual use.

ublk_ch_uring_cmd() is safe when called as a retry operation, as the
memory backing is stable at that point. But for normal issue, we want
to ensure that we only read ublksrv_io_cmd once. Wrap the function in
a helper that reads the value into an on-stack copy of the struct.

Cc: stable@vger.kernel.org # 6.0+
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/ublk_drv.c