sock_diag: fix autoloading of the raw_diag module
Subsystems (3)
PATCH 1/1 sock_diag: fix autoloading of the raw_diag module
IPPROTO_TCP isn't registred as an inet protocol, so inet_protos[protocol] is always NULL for it.
--- net/core/sock.c | 1 + 1 file changed, 1 insertion(+)
net/core/sock.c +1 -0
@@ -3279,6 +3279,7 @@ int sock_load_diag_module(int family, int protocol)#ifdef CONFIG_INET if (family ==AF_INET && + protocol !=IPPROTO_RAW && !rcu_access_pointer (inet_protos[protocol]))return -ENOENT ;#endif
Signature · 1 line
2.17.2
Quoted 2 lines · Andrei Vagin
IPPROTO_TCPisn't registred as an inet protocol, so inet_protos[protocol] is always NULL for it.
Typo, IPPROTO_RAW
Quoted 14 lines
Cc Cyrill Gorcunov <[email protected]>Cc Xin Long <[email protected]>Fixes bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered")Signed-off-by Andrei Vagin <[email protected]>--- net/core/sock.c | 1 + 1 file changed, 1 insertion(+)net/core/sock.c +0
-0
net/core/sock.c int sock_load_diag_module(int family, int protocol) · line 3285
Quoted 7 lines
net/core/sock.c +1
-0@@ -3279,6 +3279,7 @@ int sock_load_diag_module(int family, int protocol)#ifdef CONFIG_INET if (family ==AF_INET && + protocol !=IPPROTO_RAW && !rcu_access_pointer (inet_protos[protocol]))return -ENOENT ;#endif
Andrew, looking into kernel code I wonder, maybe we should simply add this protocol into inet_protos during net/ipv4/af_inet.c:inet_init? It will require to add netns_ok into raw_prot of course.
Cyrill Gorcunov
Reviewed-byQuoted 4 lines · Cyrill Gorcunov
Andrew, looking into kernel code I wonder, maybe we should simply add this protocol into
inet_protosduring net/ipv4/af_inet.c:inet_init? It will require to addnetns_okintoraw_protof course.
After spending some time on this idea I think your patch is better, since it is small and suitable for a -stable fix (because the former issue is definitely changing the kernel behaviour, the fix should be passed to -stable as well).
David Miller
maintainerFrom: Andrei Vagin <[email protected]>
Date: Sun, 4 Nov 2018 22:37:15 -0800
Quoted 7 lines
IPPROTO_TCPisn't registred as an inet protocol, so inet_protos[protocol] is always NULL for it.Cc Cyrill Gorcunov <[email protected]>Cc Xin Long <[email protected]>Fixes bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered")Signed-off-by Andrei Vagin <[email protected]>
Applied and queued up for -stable.