Skip to content

Commit

Permalink
rds: prevent dereference of a NULL device in rds_iw_laddr_check
Browse files Browse the repository at this point in the history
Binding might result in a NULL device which is later dereferenced
without checking.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
sashalevin authored and davem330 committed Mar 31, 2014
1 parent 2d3b479 commit bf39b42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/rds/iw.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr)
ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
/* due to this, we will claim to support IB devices unless we
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;

rdsdebug("addr %pI4 ret %d node type %d\n",
Expand Down

0 comments on commit bf39b42

Please sign in to comment.