summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2018-11-04 22:37:15 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-01 09:17:18 +0100
commit811c8141d663e399f9413eba23eb046c98b16665 (patch)
treead9bed8029bb8b41f4b0843d04b5030b6261cf00 /net
parent3c69a033b416cdebf455787f51750e3ab0c12718 (diff)
downloadlinux-stable-811c8141d663e399f9413eba23eb046c98b16665.tar.gz
linux-stable-811c8141d663e399f9413eba23eb046c98b16665.tar.bz2
linux-stable-811c8141d663e399f9413eba23eb046c98b16665.zip
sock_diag: fix autoloading of the raw_diag module
[ Upstream commit c34c1287778b080ed692c0a46a8e345206cc29e6 ] IPPROTO_RAW isn't registred as an inet protocol, so inet_protos[protocol] is always NULL for it. Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Xin Long <lucien.xin@gmail.com> Fixes: bf2ae2e4bf93 ("sock_diag: request _diag module only when the family or proto has been registered") Signed-off-by: Andrei Vagin <avagin@gmail.com> Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/sock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 6c1107821776..ba4f843cdd1d 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3347,6 +3347,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