Skip to content

Commit

Permalink
IB/core: Namespace is mandatory input for address resolution
Browse files Browse the repository at this point in the history
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: 565edd1 ('IB/addr: Pass network namespace as a parameter')
Cc: <[email protected]> # v4.3+
Signed-off-by: Moni Shoua <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
monis410 authored and dledford committed Jul 17, 2017
1 parent c8c16d3 commit bebb2a4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/infiniband/core/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@ static int addr_resolve(struct sockaddr *src_in,
struct dst_entry *dst;
int ret;

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

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

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

return ret;
Expand Down

0 comments on commit bebb2a4

Please sign in to comment.