Re: [PATCH 2/4] ublk: don't write to struct ublksrv_ctrl_cmd
From: Ming Lei
Date: Fri Jan 30 2026 - 10:51:36 EST
On Thu, Jan 29, 2026 at 03:46:15PM -0700, Caleb Sander Mateos wrote:
> ublk_ctrl_uring_cmd_permission() writes to struct ublksrv_ctrl_cmd's
> addr and len fields, which is racy because ublksrv_ctrl_cmd is part of
> the io_uring_sqe, which may lie in userspace-mapped memory. Store the
> values of addr in len in local variables instead to avoid the race.
>
> Fixes: 87213b0d847c ("ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue")
> Signed-off-by: Caleb Sander Mateos <csander@xxxxxxxxxxxxxxx>
The simpler approach is to define local `header` variable and copy data to
it.
Given it is introduced in v6.19-rc1, backport should be easy, so this patch
looks fine:
Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>
Thanks,
Ming