IB/mlx4: Avoid null pointer dereference in mlx4_ib_scan_netdevs()
authorMoni Shoua <monis@mellanox.com>
Thu, 21 Aug 2014 11:28:37 +0000 (14:28 +0300)
committerRoland Dreier <roland@purestorage.com>
Mon, 22 Sep 2014 16:46:52 +0000 (09:46 -0700)
commite381835cf1b8e3b2857277dbc3b77d8c5350f70a
tree5fdd73c629fe7753fbd4c5b29317df7b96ee9e20
parent4ff0acca7344c93fd9ed778b4c3ce16d95c594e4
IB/mlx4: Avoid null pointer dereference in mlx4_ib_scan_netdevs()

When Ethernet netdev is not present for a port (e.g. when the link
layer type of the port is InfiniBand) it's possible to dereference a
null pointer when we do netdevice scanning.

To fix that, we move a section of code that needs to run only when
netdev is present to a proper if () statement.

Fixes: ad4885d279b6 ("IB/mlx4: Build the port IBoE GID table properly under bonding")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx4/main.c