public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: "ira.weiny" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Amir Vadai <amirv-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rc-fixes 1/2] IB/IPoIB: Fix bad error flow in ipoib_add_port()
Date: Wed, 1 Jul 2015 15:29:18 -0400	[thread overview]
Message-ID: <20150701192918.GA4497@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <1435750262-32210-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On Wed, Jul 01, 2015 at 02:31:01PM +0300, Or Gerlitz wrote:
> From: Amir Vadai <amirv-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Error values of ib_query_port() and ib_query_device() weren't propagated
> correctly. Because of that, ipoib_add_port() could return NULL value,
> which escaped the IS_ERR() check in ipoib_add_one() and we crashed.
> 
> Signed-off-by: Amir Vadai <amirv-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> ---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> index da149c2..55231bb 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -1577,7 +1577,8 @@ static struct net_device *ipoib_add_port(const char *format,
>  	SET_NETDEV_DEV(priv->dev, hca->dma_device);
>  	priv->dev->dev_id = port - 1;
>  
> -	if (!ib_query_port(hca, port, &attr))
> +	result = ib_query_port(hca, port, &attr);
> +	if (!result)
>  		priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);
>  	else {
>  		printk(KERN_WARNING "%s: ib_query_port %d failed\n",
> @@ -1598,7 +1599,8 @@ static struct net_device *ipoib_add_port(const char *format,
>  		goto device_init_failed;
>  	}
>  
> -	if (ipoib_set_dev_features(priv, hca))
> +	result = ipoib_set_dev_features(priv, hca);
> +	if (result)
>  		goto device_init_failed;
>  
>  	/*
> -- 
> 2.3.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-07-01 19:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 11:31 [PATCH rc-fixes 0/2] mlx4 and ipoib Fixes for 4.2-rc1 Or Gerlitz
     [not found] ` <1435750262-32210-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-01 11:31   ` [PATCH rc-fixes 1/2] IB/IPoIB: Fix bad error flow in ipoib_add_port() Or Gerlitz
     [not found]     ` <1435750262-32210-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-01 19:29       ` ira.weiny [this message]
2015-07-01 11:31   ` [PATCH rc-fixes 2/2] IB/mlx4: Do not attemp to report HCA clock offset on VFs Or Gerlitz

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=20150701192918.GA4497@phlsvsds.ph.intel.com \
    --to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=amirv-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /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