From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yanjun Zhu Subject: Re: [PATCH] IB/IPoIB: Fix error code in ipoib_add_port() Date: Mon, 24 Jul 2017 10:53:12 +0800 Message-ID: References: <20170713074548.i6cgpjhmmcnvtd5c@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170713074548.i6cgpjhmmcnvtd5c@mwanda> Content-Language: en-US Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Dan Carpenter , Doug Ledford Cc: Sean Hefty , Hal Rosenstock , Leon Romanovsky , Erez Shitrit , Alex Vesker , Dasaratharaman Chandramouli , Feras Daoud , Shamir Rabinovitch , Paolo Abeni , David Ahern , linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-rdma@vger.kernel.org Thanks! Reviewed-by: Zhu Yanjun On 2017/7/13 15:45, Dan Carpenter wrote: > We accidentally don't see the error code on some of these error paths. > It means we return ERR_PTR(0) which is NULL and it results in a NULL > dereference in the caller. > > This bug dates to pre-git days. > > Signed-off-by: Dan Carpenter > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c > index 6e86eeee370e..ddd8114b6713 100644 > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c > @@ -2212,6 +2212,7 @@ static struct net_device *ipoib_add_port(const char *format, > goto register_failed; > } > > + result = -ENOMEM; > if (ipoib_cm_add_mode_attr(priv->dev)) > goto sysfs_failed; > if (ipoib_add_pkey_attr(priv->dev)) > -- 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