Thread (11 messages) 11 messages, 4 authors, 16d ago

Re: [PATCH net-next 1/2] net: add sockopt_expand_out()

From: Stanislav Fomichev <hidden>
Date: 2026-09-11 21:17:46
Also in: lkml

On 09/11, Breno Leitao wrote:
On Fri, Sep 11, 2026 at 08:56:23AM -0700, Stanislav Fomichev wrote:
quoted
On 09/10, Breno Leitao wrote:
quoted
+	if (size <= iov_iter_count(&opt->iter_out))
+		return 0;
+
+	if (WARN_ON_ONCE(!iter_is_ubuf(&opt->iter_out)))
+		return -EINVAL;
nit: if you end up re-spinning for some reason, maybe swap these two?
I am not sure we want to swap these two. This is the reason:

1) The first check (size <= iov_iter_count(&opt->iter_out)), check if we
   need the "hack" or not.

   a) If we don't need the tack, then we are fine and this could be called
      from user or kernel.
   
   b) for the hack (which happens in the next line -- iov_iter_ubuf()), it
      needs to be ubuf.

So, this force kernel callers to use the right optlen, avoiding hitting
the same issue as userspace.
Hmm, that feels a bit too magical :-/ Who are the kernel callers? Do we
have any? Is it reachable via bpf or something else?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help