From: Chris Mason Date: Fri, 3 Feb 2012 16:09:07 +0000 (-0500) Subject: rds: make sure we don't deref a null cm_id->device during address checks X-Git-Tag: v4.1.12-92~319^2^2~2^2~40 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4120570bb3f9cf3db0d8ead3dad223baf8df0a6d;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/net/rds/ib.c b/net/rds/ib.c index ca84d32640f03..4d8c00f797b21 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 da6c4b14a3679..bea934078825e 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",