Skip to content

Commit 2bcbf42

Browse files
emuslnkuba-moo
authored andcommitted
ionic: check port ptr before use
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>
1 parent 2aaf09a commit 2bcbf42

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/net/ethernet/pensando/ionic/ionic_ethtool.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev,
126126

127127
ethtool_link_ksettings_zero_link_mode(ks, supported);
128128

129+
if (!idev->port_info) {
130+
netdev_err(netdev, "port_info not initialized\n");
131+
return -EOPNOTSUPP;
132+
}
133+
129134
/* The port_info data is found in a DMA space that the NIC keeps
130135
* up-to-date, so there's no need to request the data from the
131136
* NIC, we already have it in our memory space.

0 commit comments

Comments
 (0)