1
0
Fork 0

ionic: check port ptr before use

[ Upstream commit 2bcbf42add ]

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

Fixes: 4d03e00a21 ("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>
5.4-rM2-2.2.x-imx-squashed
Shannon Nelson 2020-11-04 11:56:06 -08:00 committed by Greg Kroah-Hartman
parent 6ef3bcc25a
commit ac343efb57
1 changed files with 5 additions and 0 deletions

View File

@ -125,6 +125,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.