Subject: Re: [PATCH net] vsock: Use container_of() to get net namespace in sysctl handlers

From: Greg Kroah-Hartman <[email-masked]>
Date: Wed, 25 Feb 2026 06:33:45 -0800

On Tue, Feb 24, 2026 at 10:54:58AM +0100, Stefano Garzarella wrote:
> On Mon, Feb 23, 2026 at 06:32:18PM +0100, Greg Kroah-Hartman wrote:
> > current->nsproxy is should not be accessed directly as syzbot has found
>                   ^
> nit: "is" can be removed
> 
> > that it could be NULL at times, causing crashes.  Fix up the af_vsock
> > sysctl handlers to use container_of() to deal with the current net
> > namespace instead of attempting to rely on current.
> > 
> > This is the same type of change done in commit 7f5611cbc487 ("rds:
> > sysctl: rds_tcp_{rcv,snd}buf: avoid using current->nsproxy")
> > 
> > Cc: Stefano Garzarella <[email-masked]>
> > Cc: stable <[email-masked]>
> 
> I'm not sure this is stable material since these changes landed in the
> latest merge window (v7.0-rc1), but yeah, you know better than me, so there
> could be a reason.
> 
> If needed, maybe we can also add:
> 
> Fixes: eafb64f40ca4 ("vsock: add netns to vsock core")

Ah, I missed that this was a "new" thing, you are right, cc: stable
wasn't needed, and the fixes: tag is good to have.  I don't normally add
those as it's up to me to do the backports and I can figure it out on my
own when they hit Linus's tree :)

> > Assisted-by: gkh_clanker_2000
> > Signed-off-by: Greg Kroah-Hartman <[email-masked]>
> > ---
> > 
> > Note, this is compile-tested only.  Some of my scripts found this when
> > looking for places that are missing fixes that were applied to other
> > parts of the kernel.  I think the af_vsock code uses namespaces, but as
> > I don't know the network stack at all I figured I would let you all
> > review it to tell me how wrong I got this change and all is fine with
> > the original code.
> 
> Thanks! LGTM and tests are fine!
> 
> Reviewed-by: Stefano Garzarella <[email-masked]>

Great, thanks for testing and the review!

greg k-h