All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ionic: check port ptr before use
@ 2020-11-04 19:56 Shannon Nelson
  2020-11-05 18:01 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Shannon Nelson @ 2020-11-04 19:56 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: Shannon Nelson

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 <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index ed9808fc743b..35c72d4a78b3 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -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.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ionic: check port ptr before use
  2020-11-04 19:56 [PATCH net] ionic: check port ptr before use Shannon Nelson
@ 2020-11-05 18:01 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-11-05 18:01 UTC (permalink / raw)
  To: Shannon Nelson; +Cc: netdev, davem

On Wed,  4 Nov 2020 11:56:06 -0800 Shannon Nelson wrote:
> 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 <snelson@pensando.io>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-05 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 19:56 [PATCH net] ionic: check port ptr before use Shannon Nelson
2020-11-05 18:01 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.