Commit 5c8857b6 authored by Dan Carpenter's avatar Dan Carpenter Committed by Doug Ledford

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 653f0a71
...@@ -2239,6 +2239,7 @@ static struct net_device *ipoib_add_port(const char *format, ...@@ -2239,6 +2239,7 @@ static struct net_device *ipoib_add_port(const char *format,
goto register_failed; goto register_failed;
} }
result = -ENOMEM;
if (ipoib_cm_add_mode_attr(priv->dev)) if (ipoib_cm_add_mode_attr(priv->dev))
goto sysfs_failed; goto sysfs_failed;
if (ipoib_add_pkey_attr(priv->dev)) if (ipoib_add_pkey_attr(priv->dev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment