Re: [PATCH] IB/IPoIB: Fix error code in ipoib_add_port()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks!
Reviewed-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxxx>


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 <dan.carpenter@xxxxxxxxxx>

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 kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux