Commit 61c37028 authored by Mark Bloch's avatar Mark Bloch Committed by Doug Ledford

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: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarAlex Vesker <valex@mellanox.com>
Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent aeb76df4
...@@ -699,13 +699,16 @@ EXPORT_SYMBOL(rdma_addr_cancel); ...@@ -699,13 +699,16 @@ EXPORT_SYMBOL(rdma_addr_cancel);
struct resolve_cb_context { struct resolve_cb_context {
struct rdma_dev_addr *addr; struct rdma_dev_addr *addr;
struct completion comp; struct completion comp;
int status;
}; };
static void resolve_cb(int status, struct sockaddr *src_addr, static void resolve_cb(int status, struct sockaddr *src_addr,
struct rdma_dev_addr *addr, void *context) struct rdma_dev_addr *addr, void *context)
{ {
memcpy(((struct resolve_cb_context *)context)->addr, addr, sizeof(struct if (!status)
rdma_dev_addr)); 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); complete(&((struct resolve_cb_context *)context)->comp);
} }
...@@ -743,6 +746,10 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, ...@@ -743,6 +746,10 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
wait_for_completion(&ctx.comp); wait_for_completion(&ctx.comp);
ret = ctx.status;
if (ret)
return ret;
memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN); memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN);
dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if); dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if);
if (!dev) if (!dev)
......
Markdown is supported
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