From: Dan Carpenter Date: Thu, 13 Jul 2017 07:45:48 +0000 (+0300) Subject: IB/IPoIB: Fix error code in ipoib_add_port() X-Git-Tag: v4.14-rc1~242^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c8857b653e71a9850a02837e1268e3198abbd1a;p=platform%2Fkernel%2Flinux-rpi.git IB/IPoIB: Fix error code in ipoib_add_port() 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 Reviewed-by: Leon Romanovsky Signed-off-by: Doug Ledford --- diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 70dacaf..4ce315c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -2239,6 +2239,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))