public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/IPoIB: Fix error code in ipoib_add_port()
@ 2017-07-13  7:45 Dan Carpenter
  2017-07-13 10:25 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-07-13  7:45 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Sean Hefty, Hal Rosenstock, Leon Romanovsky, Erez Shitrit,
	Alex Vesker, Dasaratharaman Chandramouli, Feras Daoud, Zhu Yanjun,
	Shamir Rabinovitch, Paolo Abeni, David Ahern, linux-rdma,
	kernel-janitors

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@oracle.com>

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))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-24  2:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13  7:45 [PATCH] IB/IPoIB: Fix error code in ipoib_add_port() Dan Carpenter
2017-07-13 10:25 ` Leon Romanovsky
2017-07-22 17:27 ` Doug Ledford
2017-07-24  2:53 ` Yanjun Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox