]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
IB/core: Namespace is mandatory input for address resolution
authorMoni Shoua <monis@mellanox.com>
Tue, 23 May 2017 07:48:44 +0000 (10:48 +0300)
committerDoug Ledford <dledford@redhat.com>
Mon, 17 Jul 2017 15:45:34 +0000 (11:45 -0400)
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: 565edd1d5555 ('IB/addr: Pass network namespace as a parameter')
Cc: <stable@vger.kernel.org> # v4.3+
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/addr.c

index a6cb379a4ebcb3060c93eb959aa3071d45f78b37..d78bc74bc9a9603255f6a0ba74e2fa0b67ed54dd 100644 (file)
@@ -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 =
@@ -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;