IB/core: Add missing check for addr_resolve callback return value
When calling rdma_resolve_ip inside rdma_addr_find_l2_eth_by_grh, the return status of the request was ignored in the callback function causing a successful return and an empty dmac. Signed-off-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Alex Vesker <valex@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
aeb76df46d
commit
61c3702863
|
@ -699,13 +699,16 @@ EXPORT_SYMBOL(rdma_addr_cancel);
|
|||
struct resolve_cb_context {
|
||||
struct rdma_dev_addr *addr;
|
||||
struct completion comp;
|
||||
int status;
|
||||
};
|
||||
|
||||
static void resolve_cb(int status, struct sockaddr *src_addr,
|
||||
struct rdma_dev_addr *addr, void *context)
|
||||
{
|
||||
memcpy(((struct resolve_cb_context *)context)->addr, addr, sizeof(struct
|
||||
rdma_dev_addr));
|
||||
if (!status)
|
||||
memcpy(((struct resolve_cb_context *)context)->addr,
|
||||
addr, sizeof(struct rdma_dev_addr));
|
||||
((struct resolve_cb_context *)context)->status = status;
|
||||
complete(&((struct resolve_cb_context *)context)->comp);
|
||||
}
|
||||
|
||||
|
@ -743,6 +746,10 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
|
|||
|
||||
wait_for_completion(&ctx.comp);
|
||||
|
||||
ret = ctx.status;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN);
|
||||
dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if);
|
||||
if (!dev)
|
||||
|
|
Loading…
Reference in New Issue