Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

calipso: unlock rcu before returning -EAFNOSUPPORT

syzbot reported that a recent patch forgot to unlock rcu
in the error path.

Adopt the convention that netlbl_conn_setattr() is already using.

Fixes: 6e9f2df1c550 ("calipso: Don't call calipso functions for AF_INET sk.")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://patch.msgid.link/20250604133826.1667664-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
3cae906e 7632fedb

+4 -2
+4 -2
net/netlabel/netlabel_kapi.c
··· 1165 1165 break; 1166 1166 #if IS_ENABLED(CONFIG_IPV6) 1167 1167 case AF_INET6: 1168 - if (sk->sk_family != AF_INET6) 1169 - return -EAFNOSUPPORT; 1168 + if (sk->sk_family != AF_INET6) { 1169 + ret_val = -EAFNOSUPPORT; 1170 + goto conn_setattr_return; 1171 + } 1170 1172 1171 1173 addr6 = (struct sockaddr_in6 *)addr; 1172 1174 entry = netlbl_domhsh_getentry_af6(secattr->domain,