[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190423090023.3520-1-Haiqing.Bai@windriver.com>
Date: Tue, 23 Apr 2019 17:00:23 +0800
From: Haiqing Bai <Haiqing.Bai@...driver.com>
To: <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <haiqing.bai@...driver.com>,
<Abdel.Elmahrad@...driver.com>
Subject: [PATCH] net: socket: Exit earlier from __sock_create if CONFIG_IPV6 is disabled
From: Radovan Prodanovic <radovan.prodanovic@...el.com>
Tests shows that it takes more than 10ms for __sock_create with
AF_INET6 returning failure if CONFIG_IPV6 is not set
The fix checks this case and make it exit with not supporting
error before calling request_module
if 'CONFIG_MODULE=y' and 'CONFIG_IPV6 is not set'
socket(AF_INET6, SOCK_STREAM, 0) can trigger this issue
Signed-off-by: Radovan Prodanovic <radovan.prodanovic@...el.com>
Signed-off-by: Abdel Elmahrad <Abdel.Elmahrad@...driver.com>
Signed-off-by: Haiqing Bai <Haiqing.Bai@...driver.com>
---
net/socket.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/socket.c b/net/socket.c
index 8255f5bda0aa..7927c2bcad65 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1339,6 +1339,11 @@ int __sock_create(struct net *net, int family, int type, int protocol,
if (type < 0 || type >= SOCK_MAX)
return -EINVAL;
+#if !(IS_ENABLED(CONFIG_IPV6))
+ if (family == AF_INET6)
+ return -EAFNOSUPPORT;
+#endif
+
/* Compatibility.
This uglymoron is moved from INET layer to here to avoid
--
2.14.4
Powered by blists - more mailing lists