Commit bf39b424 authored by Sasha Levin's avatar Sasha Levin Committed by David S. Miller

rds: prevent dereference of a NULL device in rds_iw_laddr_check

Binding might result in a NULL device which is later dereferenced
without checking.
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d3b479d
...@@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr) ...@@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr)
ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin); ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
/* due to this, we will claim to support IB devices unless we /* due to this, we will claim to support IB devices unless we
check node_type. */ check node_type. */
if (ret || cm_id->device->node_type != RDMA_NODE_RNIC) if (ret || !cm_id->device ||
cm_id->device->node_type != RDMA_NODE_RNIC)
ret = -EADDRNOTAVAIL; ret = -EADDRNOTAVAIL;
rdsdebug("addr %pI4 ret %d node type %d\n", rdsdebug("addr %pI4 ret %d node type %d\n",
......
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