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

Configure Feed

Select the types of activity you want to include in your feed.

af_unix: Remove unix_unhash()

Dummy unix_unhash() was introduced for sockmap in commit 94531cfcbe79
("af_unix: Add unix_stream_proto for sockmap"), but there's no need to
implement it anymore.

->unhash() is only called conditionally: in unix_shutdown() since commit
d359902d5c35 ("af_unix: Fix NULL pointer bug in unix_shutdown"), and in BPF
proto's sock_map_unhash() since commit 5b4a79ba65a1 ("bpf, sockmap: Don't
let sock_map_{close,destroy,unhash} call itself").

Remove it.

Signed-off-by: Michal Luczaj <mhal@rbox.co>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250409-cleanup-drop-unix-unhash-v1-1-1659e5b8ee84@rbox.co
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Michal Luczaj and committed by
Jakub Kicinski
709894c5 cb710329

-8
-8
net/unix/af_unix.c
··· 950 950 */ 951 951 } 952 952 953 - static void unix_unhash(struct sock *sk) 954 - { 955 - /* Nothing to do here, unix socket does not need a ->unhash(). 956 - * This is merely for sockmap. 957 - */ 958 - } 959 - 960 953 static bool unix_bpf_bypass_getsockopt(int level, int optname) 961 954 { 962 955 if (level == SOL_SOCKET) { ··· 980 987 .owner = THIS_MODULE, 981 988 .obj_size = sizeof(struct unix_sock), 982 989 .close = unix_close, 983 - .unhash = unix_unhash, 984 990 .bpf_bypass_getsockopt = unix_bpf_bypass_getsockopt, 985 991 #ifdef CONFIG_BPF_SYSCALL 986 992 .psock_update_sk_prot = unix_stream_bpf_update_proto,