Commit 32a25f2e authored by Kamal Heib's avatar Kamal Heib Committed by Jason Gunthorpe
Browse files

RDMA/rxe: Fix failure during driver load

To avoid the following failure when trying to load the rdma_rxe module
while IPv6 is disabled, add a check for EAFNOSUPPORT and ignore the
failure, also delete the needless debug print from rxe_setup_udp_tunnel().

$ modprobe rdma_rxe
modprobe: ERROR: could not insert 'rdma_rxe': Operation not permitted

Fixes: dfdd6158 ("IB/rxe: Fix kernel panic in udp_setup_tunnel")
Link: https://lore.kernel.org/r/20210603090112.36341-1-kamalheib1@gmail.com


Reported-by: default avatarYi Zhang <yi.zhang@redhat.com>
Signed-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 5bcf5a59
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -207,10 +207,8 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port,


	/* Create UDP socket */
	/* Create UDP socket */
	err = udp_sock_create(net, &udp_cfg, &sock);
	err = udp_sock_create(net, &udp_cfg, &sock);
	if (err < 0) {
	if (err < 0)
		pr_err("failed to create udp socket. err = %d\n", err);
		return ERR_PTR(err);
		return ERR_PTR(err);
	}


	tnl_cfg.encap_type = 1;
	tnl_cfg.encap_type = 1;
	tnl_cfg.encap_rcv = rxe_udp_encap_recv;
	tnl_cfg.encap_rcv = rxe_udp_encap_recv;
@@ -619,6 +617,12 @@ static int rxe_net_ipv6_init(void)


	recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
	recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
						htons(ROCE_V2_UDP_DPORT), true);
						htons(ROCE_V2_UDP_DPORT), true);
	if (PTR_ERR(recv_sockets.sk6) == -EAFNOSUPPORT) {
		recv_sockets.sk6 = NULL;
		pr_warn("IPv6 is not supported, can not create a UDPv6 socket\n");
		return 0;
	}

	if (IS_ERR(recv_sockets.sk6)) {
	if (IS_ERR(recv_sockets.sk6)) {
		recv_sockets.sk6 = NULL;
		recv_sockets.sk6 = NULL;
		pr_err("Failed to create IPv6 UDP tunnel\n");
		pr_err("Failed to create IPv6 UDP tunnel\n");