Commit 0965cc95 authored by YueHaibing's avatar YueHaibing Committed by Jason Gunthorpe
Browse files

RDMA/core: Properly return the error code of rdma_set_src_addr_rcu

rdma_set_src_addr_rcu should check copy_src_l2_addr fails, rather than
always return 0. Also copy_src_l2_addr should return 'ret' as its return
value when rdma_translate_ip fails.

Fixes: c31d4b2d

 ("RDMA/core: Protect against changing dst->dev during destination resolve")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 802fa45c
......@@ -468,10 +468,10 @@ static int addr_resolve_neigh(const struct dst_entry *dst,
return ret;
}
static void copy_src_l2_addr(struct rdma_dev_addr *dev_addr,
const struct sockaddr *dst_in,
const struct dst_entry *dst,
const struct net_device *ndev)
static int copy_src_l2_addr(struct rdma_dev_addr *dev_addr,
const struct sockaddr *dst_in,
const struct dst_entry *dst,
const struct net_device *ndev)
{
int ret = 0;
......@@ -492,6 +492,8 @@ static void copy_src_l2_addr(struct rdma_dev_addr *dev_addr,
RDMA_NETWORK_IPV6;
else
dev_addr->network = RDMA_NETWORK_IB;
return ret;
}
static int rdma_set_src_addr_rcu(struct rdma_dev_addr *dev_addr,
......@@ -515,8 +517,7 @@ static int rdma_set_src_addr_rcu(struct rdma_dev_addr *dev_addr,
return -ENODEV;
}
copy_src_l2_addr(dev_addr, dst_in, dst, ndev);
return 0;
return copy_src_l2_addr(dev_addr, dst_in, dst, ndev);
}
static int set_addr_netns_by_gid_rcu(struct rdma_dev_addr *addr)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment