From: Zhu Yanjun <zyjzyj2000@xxxxxxxxx> When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled in the stack. As such, the operations of ipv6 will fail. So ipv6 features in addr should also be disabled. Fixes: caf1e3ae9fa6 ("RDMA/core Introduce and use rdma_find_ndev_for_src_ip_rcu") Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Signed-off-by: Zhu Yanjun <zyjzyj2000@xxxxxxxxx> --- drivers/infiniband/core/addr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 0abce004a959..6fa57b83c4b1 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -257,6 +257,9 @@ rdma_find_ndev_for_src_ip_rcu(struct net *net, const struct sockaddr *src_in) break; #if IS_ENABLED(CONFIG_IPV6) case AF_INET6: + if (!ipv6_mod_enabled()) + return ERR_PTR(-EPFNOSUPPORT); + for_each_netdev_rcu(net, dev) { if (ipv6_chk_addr(net, &((const struct sockaddr_in6 *)src_in)->sin6_addr, @@ -424,6 +427,9 @@ static int addr6_resolve(struct sockaddr *src_sock, struct flowi6 fl6; struct dst_entry *dst; + if (!ipv6_mod_enabled()) + return -EADDRNOTAVAIL; + memset(&fl6, 0, sizeof fl6); fl6.daddr = dst_in->sin6_addr; fl6.saddr = src_in->sin6_addr; -- 2.27.0