* [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
@ 2021-03-08 20:41 ` Alexander Duyck
0 siblings, 0 replies; 6+ messages in thread
From: Alexander Duyck @ 2021-03-08 20:41 UTC (permalink / raw)
To: intel-wired-lan; +Cc: jesse.brandeburg, anthony.l.nguyen, netdev
From: Alexander Duyck <alexanderduyck@fb.com>
The ixgbe driver currently generates a NULL pointer dereference when
performing the ethtool loopback test. This is due to the fact that there
isn't a q_vector associated with the test ring when it is setup as
interrupts are not normally added to the test rings.
To address this I have added code that will check for a q_vector before
returning a napi_id value. If a q_vector is not present it will return a
value of 0.
Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index fae84202d870..724cdd669957 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6534,6 +6534,13 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
return err;
}
+static int ixgbe_rx_napi_id(struct ixgbe_ring *rx_ring)
+{
+ struct ixgbe_q_vector *q_vector = rx_ring->q_vector;
+
+ return q_vector ? q_vector->napi.napi_id : 0;
+}
+
/**
* ixgbe_setup_rx_resources - allocate Rx resources (Descriptors)
* @adapter: pointer to ixgbe_adapter
@@ -6582,7 +6589,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
/* XDP RX-queue info */
if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev,
- rx_ring->queue_index, rx_ring->q_vector->napi.napi_id) < 0)
+ rx_ring->queue_index, ixgbe_rx_napi_id(rx_ring)) < 0)
goto err;
rx_ring->xdp_prog = adapter->xdp_prog;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Intel-wired-lan] [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
@ 2021-03-08 20:41 ` Alexander Duyck
0 siblings, 0 replies; 6+ messages in thread
From: Alexander Duyck @ 2021-03-08 20:41 UTC (permalink / raw)
To: intel-wired-lan
From: Alexander Duyck <alexanderduyck@fb.com>
The ixgbe driver currently generates a NULL pointer dereference when
performing the ethtool loopback test. This is due to the fact that there
isn't a q_vector associated with the test ring when it is setup as
interrupts are not normally added to the test rings.
To address this I have added code that will check for a q_vector before
returning a napi_id value. If a q_vector is not present it will return a
value of 0.
Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index fae84202d870..724cdd669957 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6534,6 +6534,13 @@ static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
return err;
}
+static int ixgbe_rx_napi_id(struct ixgbe_ring *rx_ring)
+{
+ struct ixgbe_q_vector *q_vector = rx_ring->q_vector;
+
+ return q_vector ? q_vector->napi.napi_id : 0;
+}
+
/**
* ixgbe_setup_rx_resources - allocate Rx resources (Descriptors)
* @adapter: pointer to ixgbe_adapter
@@ -6582,7 +6589,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
/* XDP RX-queue info */
if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev,
- rx_ring->queue_index, rx_ring->q_vector->napi.napi_id) < 0)
+ rx_ring->queue_index, ixgbe_rx_napi_id(rx_ring)) < 0)
goto err;
rx_ring->xdp_prog = adapter->xdp_prog;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
2021-03-08 20:41 ` [Intel-wired-lan] " Alexander Duyck
@ 2021-03-09 7:29 ` =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
-1 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2021-03-09 7:29 UTC (permalink / raw)
To: Alexander Duyck; +Cc: intel-wired-lan, Netdev, bpf
On Mon, 8 Mar 2021 at 21:42, Alexander Duyck <alexander.duyck@gmail.com> wrote:
>
> From: Alexander Duyck <alexanderduyck@fb.com>
>
> The ixgbe driver currently generates a NULL pointer dereference when
> performing the ethtool loopback test. This is due to the fact that there
> isn't a q_vector associated with the test ring when it is setup as
> interrupts are not normally added to the test rings.
>
> To address this I have added code that will check for a q_vector before
> returning a napi_id value. If a q_vector is not present it will return a
> value of 0.
>
> Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Thanks Alex!
Acked-by: Björn Töpel <bjorn.topel@intel.com>
I'll look into if this applies to the other Intel drivers as well.
Björn
[...]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-wired-lan] [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
@ 2021-03-09 7:29 ` =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
0 siblings, 0 replies; 6+ messages in thread
From: =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= @ 2021-03-09 7:29 UTC (permalink / raw)
To: intel-wired-lan
On Mon, 8 Mar 2021 at 21:42, Alexander Duyck <alexander.duyck@gmail.com> wrote:
>
> From: Alexander Duyck <alexanderduyck@fb.com>
>
> The ixgbe driver currently generates a NULL pointer dereference when
> performing the ethtool loopback test. This is due to the fact that there
> isn't a q_vector associated with the test ring when it is setup as
> interrupts are not normally added to the test rings.
>
> To address this I have added code that will check for a q_vector before
> returning a napi_id value. If a q_vector is not present it will return a
> value of 0.
>
> Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Thanks Alex!
Acked-by: Bj?rn T?pel <bjorn.topel@intel.com>
I'll look into if this applies to the other Intel drivers as well.
Bj?rn
[...]
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
2021-03-08 20:41 ` [Intel-wired-lan] " Alexander Duyck
@ 2021-04-09 19:39 ` Switzer, David
-1 siblings, 0 replies; 6+ messages in thread
From: Switzer, David @ 2021-04-09 19:39 UTC (permalink / raw)
To: Alexander Duyck, intel-wired-lan
Cc: Brandeburg, Jesse, Nguyen, Anthony L, netdev
>-----Original Message-----
>From: Alexander Duyck <alexander.duyck@gmail.com>
>Sent: Monday, March 8, 2021 12:42 PM
>To: intel-wired-lan@lists.osuosl.org
>Cc: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L
><anthony.l.nguyen@intel.com>; netdev@vger.kernel.org
>Subject: [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
>
>From: Alexander Duyck <alexanderduyck@fb.com>
>
>The ixgbe driver currently generates a NULL pointer dereference when
>performing the ethtool loopback test. This is due to the fact that there isn't a
>q_vector associated with the test ring when it is setup as interrupts are not
>normally added to the test rings.
>
>To address this I have added code that will check for a q_vector before returning
>a napi_id value. If a q_vector is not present it will return a value of 0.
>
>Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
>Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
>---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
Tested-by: Dave Switzer <david.switzer@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-wired-lan] [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
@ 2021-04-09 19:39 ` Switzer, David
0 siblings, 0 replies; 6+ messages in thread
From: Switzer, David @ 2021-04-09 19:39 UTC (permalink / raw)
To: intel-wired-lan
>-----Original Message-----
>From: Alexander Duyck <alexander.duyck@gmail.com>
>Sent: Monday, March 8, 2021 12:42 PM
To: intel-wired-lan@lists.osuosl.org
>Cc: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L
><anthony.l.nguyen@intel.com>; netdev at vger.kernel.org
>Subject: [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test
>
>From: Alexander Duyck <alexanderduyck@fb.com>
>
>The ixgbe driver currently generates a NULL pointer dereference when
>performing the ethtool loopback test. This is due to the fact that there isn't a
>q_vector associated with the test ring when it is setup as interrupts are not
>normally added to the test rings.
>
>To address this I have added code that will check for a q_vector before returning
>a napi_id value. If a q_vector is not present it will return a value of 0.
>
>Fixes: b02e5a0ebb17 ("xsk: Propagate napi_id to XDP socket Rx path")
>Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
>---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
Tested-by: Dave Switzer <david.switzer@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-04-09 19:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 20:41 [net PATCH] ixgbe: Fix NULL pointer dereference in ethtool loopback test Alexander Duyck
2021-03-08 20:41 ` [Intel-wired-lan] " Alexander Duyck
2021-03-09 7:29 ` Björn Töpel
2021-03-09 7:29 ` =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2021-04-09 19:39 ` Switzer, David
2021-04-09 19:39 ` [Intel-wired-lan] " Switzer, David
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.