Thread (5 messages) 5 messages, 4 authors, 2026-02-26

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

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2026-02-25 14:33:53
Also in: lkml, virtualization

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:
quoted
current->nsproxy is should not be accessed directly as syzbot has found
                  ^
nit: "is" can be removed
quoted
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 <sgarzare@redhat.com>
Cc: stable <stable@kernel.org>
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 :)
quoted
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

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 <sgarzare@redhat.com>
Great, thanks for testing and the review!

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help