Skip to content

Commit bebb2a4

Browse files
monis410dledford
authored andcommitted
IB/core: Namespace is mandatory input for address resolution
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]>
1 parent c8c16d3 commit bebb2a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/infiniband/core/addr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@ static int addr_resolve(struct sockaddr *src_in,
509509
struct dst_entry *dst;
510510
int ret;
511511

512+
if (!addr->net) {
513+
pr_warn_ratelimited("%s: missing namespace\n", __func__);
514+
return -EINVAL;
515+
}
516+
512517
if (src_in->sa_family == AF_INET) {
513518
struct rtable *rt = NULL;
514519
const struct sockaddr_in *dst_in4 =
@@ -546,7 +551,6 @@ static int addr_resolve(struct sockaddr *src_in,
546551
}
547552

548553
addr->bound_dev_if = ndev->ifindex;
549-
addr->net = dev_net(ndev);
550554
dev_put(ndev);
551555

552556
return ret;

0 commit comments

Comments
 (0)