* [PATCH] rds: prevent dereference of a NULL device in rds_iw_laddr_check
@ 2013-12-20 23:18 Sasha Levin
2013-12-21 0:31 ` Sergei Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2013-12-20 23:18 UTC (permalink / raw)
To: venkat.x.venkatsubra, davem; +Cc: rds-devel, netdev, linux-kernel, Sasha Levin
Binding might result in a NULL device which is later dereferenced
without checking.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
net/rds/iw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/rds/iw.c b/net/rds/iw.c
index 7826d46..0298920 100644
--- a/net/rds/iw.c
+++ b/net/rds/iw.c
@@ -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",
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rds: prevent dereference of a NULL device in rds_iw_laddr_check
2013-12-20 23:18 [PATCH] rds: prevent dereference of a NULL device in rds_iw_laddr_check Sasha Levin
@ 2013-12-21 0:31 ` Sergei Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2013-12-21 0:31 UTC (permalink / raw)
To: Sasha Levin, venkat.x.venkatsubra, davem; +Cc: rds-devel, netdev, linux-kernel
Hello.
On 12/21/2013 02:18 AM, Sasha Levin wrote:
> Binding might result in a NULL device which is later dereferenced
> without checking.
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> net/rds/iw.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> diff --git a/net/rds/iw.c b/net/rds/iw.c
> index 7826d46..0298920 100644
> --- a/net/rds/iw.c
> +++ b/net/rds/iw.c
> @@ -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)
Indent with tabs and then spaces, not with spaces only please, so that the
line aligns under 'ret'.
WBR, Sergei
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-21 0:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 23:18 [PATCH] rds: prevent dereference of a NULL device in rds_iw_laddr_check Sasha Levin
2013-12-21 0:31 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).