mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 17:58:00 +07:00
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: c31d4b2ddf
("RDMA/core: Protect against changing dst->dev during destination resolve")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
802fa45cd3
commit
0965cc953a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user