diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2014-03-29 20:39:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-31 16:25:52 -0400 |
commit | bf39b4247b8799935ea91d90db250ab608a58e50 (patch) | |
tree | 3b962ff584e733f658bb9fce361b2712927135b2 /net/rds/iw.c | |
parent | 2d3b479df41a10e2f41f9259fcba775bd34de6e4 (diff) |
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 <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/iw.c')
-rw-r--r-- | net/rds/iw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/rds/iw.c b/net/rds/iw.c index 7826d46baa70..589935661d66 100644 --- a/net/rds/iw.c +++ b/net/rds/iw.c | |||
@@ -239,7 +239,8 @@ static int rds_iw_laddr_check(__be32 addr) | |||
239 | ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin); | 239 | ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin); |
240 | /* due to this, we will claim to support IB devices unless we | 240 | /* due to this, we will claim to support IB devices unless we |
241 | check node_type. */ | 241 | 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) | ||
243 | ret = -EADDRNOTAVAIL; | 244 | ret = -EADDRNOTAVAIL; |
244 | 245 | ||
245 | rdsdebug("addr %pI4 ret %d node type %d\n", | 246 | rdsdebug("addr %pI4 ret %d node type %d\n", |