Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd0d6509 authored by Moni Shoua's avatar Moni Shoua Committed by Greg Kroah-Hartman
Browse files

IB/core: Namespace is mandatory input for address resolution



commit bebb2a473a43c8f84a8210687d1cbdde503046d7 upstream.

In function addr_resolve() the namespace is a required input parameter
and not an output. It is passed later for searching the routing table
and device addresses. Also, it shouldn't be copied back to the caller.

Fixes: 565edd1d ('IB/addr: Pass network namespace as a parameter')
Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5c2717f4
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -518,6 +518,11 @@ static int addr_resolve(struct sockaddr *src_in,
	struct dst_entry *dst;
	struct dst_entry *dst;
	int ret;
	int ret;


	if (!addr->net) {
		pr_warn_ratelimited("%s: missing namespace\n", __func__);
		return -EINVAL;
	}

	if (src_in->sa_family == AF_INET) {
	if (src_in->sa_family == AF_INET) {
		struct rtable *rt = NULL;
		struct rtable *rt = NULL;
		const struct sockaddr_in *dst_in4 =
		const struct sockaddr_in *dst_in4 =
@@ -555,7 +560,6 @@ static int addr_resolve(struct sockaddr *src_in,
	}
	}


	addr->bound_dev_if = ndev->ifindex;
	addr->bound_dev_if = ndev->ifindex;
	addr->net = dev_net(ndev);
	dev_put(ndev);
	dev_put(ndev);


	return ret;
	return ret;