Re: [PATCH] io_uring/bpf-ops: validate loop_step before registration

From: Pavel Begunkov

Date: Thu Nov 26 2026 - 08:29:13 EST


On 11/19/26 11:59, Sechang Lim wrote:
A struct_ops map with only ring_fd set leaves loop_step NULL. The
struct_ops update path skips a zero program fd, and bpf_ring_ops does
not validate the completed value. Without BPF_F_LINK, the update then
calls bpf_io_reg(), where io_install_bpf() triggers a kernel warning
before returning -EINVAL. With BPF_F_LINK, the warning occurs when the
link is created.

Validate loop_step before either registration path. Reject an incomplete
value with -EINVAL so malformed userspace input cannot trigger the
warning.

Looks good, thanks for the patch.

Reviewed-by: Pavel Begunkov <asml.silence@xxxxxxxxx>

--
Pavel Begunkov