Skip to content

Commit bf39b42

Browse files
sashalevindavem330
authored andcommitted
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: Sasha Levin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d3b479 commit bf39b42

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/rds/iw.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr)
239239
ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
240240
/* due to this, we will claim to support IB devices unless we
241241
check node_type. */
242-
if (ret || cm_id->device->node_type != RDMA_NODE_RNIC)
242+
if (ret || !cm_id->device ||
243+
cm_id->device->node_type != RDMA_NODE_RNIC)
243244
ret = -EADDRNOTAVAIL;
244245

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

0 commit comments

Comments
 (0)