Thread (11 messages) flat view 11 messages, 4 authors, 11d ago

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

From: Breno Leitao <leitao@debian.org>
Date: 2026-09-11 16:09:39
Also in: lkml

On Fri, Sep 11, 2026 at 08:56:23AM -0700, Stanislav Fomichev wrote:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help