[Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:37:13 MSK 2026


The MSG_ERRQUEUE path of unix_stream_recvmsg() passes the socket to
unix_recv_error(), but 'sk' is declared inside the CONFIG_BPF_SYSCALL
block a few lines above, so the function does not build without that
option:

  net/unix/af_unix.c:3073:40: error: 'sk' undeclared (first use in this
                              function)

x86_64 defconfig and the User Mode Linux defconfig - the one we want for
KUnit - both have CONFIG_BPF_SYSCALL=n, so neither has ever built this
file.

Declare 'sk' unconditionally; the BPF block keeps its own 'prot'.

Fixes: c9ccba858dd1 ("net: zerocopy over unix sockets")
Feature: net: zerocopy over unix sockets
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fa9038e89f83..7a37c06a097c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3060,9 +3060,9 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
 		.size = size,
 		.flags = flags
 	};
+	struct sock *sk = sock->sk;
 
 #ifdef CONFIG_BPF_SYSCALL
-	struct sock *sk = sock->sk;
 	const struct proto *prot = READ_ONCE(sk->sk_prot);
 
 	if (prot != &unix_stream_proto)
-- 
2.47.1



More information about the Devel mailing list