Skip to content

Commit

Permalink
ionic: check port ptr before use
Browse files Browse the repository at this point in the history
[ Upstream commit 2bcbf42 ]

Check for corner case of port_init failure before using
the port_info pointer.

Fixes: 4d03e00 ("ionic: Add initial ethtool support")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Link: https://lore.kernel.org/r/20201104195606.61184-1-snelson@pensando.io
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
emusln authored and gregkh committed Nov 10, 2020
1 parent e99df22 commit 185e170
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
Expand Up @@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev,

ethtool_link_ksettings_zero_link_mode(ks, supported);

if (!idev->port_info) {
netdev_err(netdev, "port_info not initialized\n");
return -EOPNOTSUPP;
}

/* The port_info data is found in a DMA space that the NIC keeps
* up-to-date, so there's no need to request the data from the
* NIC, we already have it in our memory space.
Expand Down

0 comments on commit 185e170

Please sign in to comment.