From 4120570bb3f9cf3db0d8ead3dad223baf8df0a6d Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Fri, 3 Feb 2012 11:09:07 -0500 Subject: [PATCH] rds: make sure we don't deref a null cm_id->device during address checks Signed-off-by: Chris Mason Signed-off-by: Bang Nguyen --- net/rds/ib.c | 2 +- net/rds/iw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rds/ib.c b/net/rds/ib.c index ca84d32640f0..4d8c00f797b2 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -336,7 +336,7 @@ static int rds_ib_laddr_check(__be32 addr) ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin); /* due to this, we will claim to support iWARP devices unless we check node_type. */ - if (ret || cm_id->device->node_type != RDMA_NODE_IB_CA) + if (ret || !cm_id->device || cm_id->device->node_type != RDMA_NODE_IB_CA) ret = -EADDRNOTAVAIL; rdsdebug("addr %pI4 ret %d node type %d\n", diff --git a/net/rds/iw.c b/net/rds/iw.c index da6c4b14a367..bea934078825 100644 --- a/net/rds/iw.c +++ b/net/rds/iw.c @@ -237,7 +237,7 @@ 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", -- 2.50.1