]> Git Repo - linux.git/commitdiff
ionic: check port ptr before use
authorShannon Nelson <[email protected]>
Wed, 4 Nov 2020 19:56:06 +0000 (11:56 -0800)
committerJakub Kicinski <[email protected]>
Thu, 5 Nov 2020 17:58:25 +0000 (09:58 -0800)
Check for corner case of port_init failure before using
the port_info pointer.

Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support")
Signed-off-by: Shannon Nelson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c

index ed9808fc743b218fa280d28d3ffb72d1c7c0ddd3..35c72d4a78b3f9ed37c4ae173346848790362484 100644 (file)
@@ -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.
This page took 0.051423 seconds and 4 git commands to generate.