“f702f8fd10255bdb10f50907527a2d4deead0b1f”上不存在“paddle/fluid/git@gitcode.net:Crayonxin2000/Paddle.git”
提交 d2e08862 编写于 作者: S Sean Hefty 提交者: Roland Dreier

IB/addr: Verify source and destination address families match

If a source address is provided, verify that the address family matches
that of the destination address.  If the source is not specified, use the
same address family as the destination.
Signed-off-by: NSean Hefty <sean.hefty@intel.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 6266ed6e
...@@ -461,18 +461,27 @@ int rdma_resolve_ip(struct rdma_addr_client *client, ...@@ -461,18 +461,27 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
if (!req) if (!req)
return -ENOMEM; return -ENOMEM;
if (src_addr) src_in = (struct sockaddr *) &req->src_addr;
memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr)); dst_in = (struct sockaddr *) &req->dst_addr;
memcpy(&req->dst_addr, dst_addr, ip_addr_size(dst_addr));
if (src_addr) {
if (src_addr->sa_family != dst_addr->sa_family) {
ret = -EINVAL;
goto err;
}
memcpy(src_in, src_addr, ip_addr_size(src_addr));
} else {
src_in->sa_family = dst_addr->sa_family;
}
memcpy(dst_in, dst_addr, ip_addr_size(dst_addr));
req->addr = addr; req->addr = addr;
req->callback = callback; req->callback = callback;
req->context = context; req->context = context;
req->client = client; req->client = client;
atomic_inc(&client->refcount); atomic_inc(&client->refcount);
src_in = (struct sockaddr *) &req->src_addr;
dst_in = (struct sockaddr *) &req->dst_addr;
req->status = addr_resolve_local(src_in, dst_in, addr); req->status = addr_resolve_local(src_in, dst_in, addr);
if (req->status == -EADDRNOTAVAIL) if (req->status == -EADDRNOTAVAIL)
req->status = addr_resolve_remote(src_in, dst_in, addr); req->status = addr_resolve_remote(src_in, dst_in, addr);
...@@ -490,10 +499,12 @@ int rdma_resolve_ip(struct rdma_addr_client *client, ...@@ -490,10 +499,12 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
default: default:
ret = req->status; ret = req->status;
atomic_dec(&client->refcount); atomic_dec(&client->refcount);
kfree(req); goto err;
break;
} }
return ret; return ret;
err:
kfree(req);
return ret;
} }
EXPORT_SYMBOL(rdma_resolve_ip); EXPORT_SYMBOL(rdma_resolve_ip);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册