From: Radovan Prodanovic <radovan.prodano...@mitel.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.prodano...@mitel.com>
Signed-off-by: Abdel Elmahrad <abdel.elmah...@windriver.com>
Signed-off-by: Haiqing Bai <haiqing....@windriver.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

Reply via email to