public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Sasha Levin <sasha.levin@oracle.com>,
	venkat.x.venkatsubra@oracle.com, davem@davemloft.net
Cc: rds-devel@oss.oracle.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rds: prevent dereference of a NULL device in rds_iw_laddr_check
Date: Sat, 21 Dec 2013 03:31:07 +0300	[thread overview]
Message-ID: <52B4E14B.6080208@cogentembedded.com> (raw)
In-Reply-To: <1387581520-10272-1-git-send-email-sasha.levin@oracle.com>

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


      reply	other threads:[~2013-12-20 23:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B4E14B.6080208@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=sasha.levin@oracle.com \
    --cc=venkat.x.venkatsubra@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox