netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sfc: farch: Potential Null Pointer Dereference in ef4_farch_handle_tx_event()
@ 2025-09-05  3:07 Chen Yufeng
  2025-09-08 12:51 ` Edward Cree
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Yufeng @ 2025-09-05  3:07 UTC (permalink / raw)
  To: ecree.xilinx; +Cc: kuba, linux, netdev, Chen Yufeng

A patch similar to 83b09a180741("sfc: farch: fix TX queue lookup in TX 
 event handling").

The code was using ef4_channel_get_tx_queue() function with a TXQ label 
parameter, when it should have been using direct queue access via 
channel->tx_queue. This mismatch could result in NULL pointer returns, 
leading to system crashes.

Signed-off-by: Chen Yufeng <chenyufeng@iie.ac.cn>
---
 drivers/net/ethernet/sfc/falcon/farch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/falcon/farch.c b/drivers/net/ethernet/sfc/falcon/farch.c
index 01017c41338e..29b34fb9fb24 100644
--- a/drivers/net/ethernet/sfc/falcon/farch.c
+++ b/drivers/net/ethernet/sfc/falcon/farch.c
@@ -838,16 +838,16 @@ ef4_farch_handle_tx_event(struct ef4_channel *channel, ef4_qword_t *event)
 		/* Transmit completion */
 		tx_ev_desc_ptr = EF4_QWORD_FIELD(*event, FSF_AZ_TX_EV_DESC_PTR);
 		tx_ev_q_label = EF4_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL);
-		tx_queue = ef4_channel_get_tx_queue(
-			channel, tx_ev_q_label % EF4_TXQ_TYPES);
+		tx_queue = channel->tx_queue +
+			(tx_ev_q_label % EF4_TXQ_TYPES);
 		tx_packets = ((tx_ev_desc_ptr - tx_queue->read_count) &
 			      tx_queue->ptr_mask);
 		ef4_xmit_done(tx_queue, tx_ev_desc_ptr);
 	} else if (EF4_QWORD_FIELD(*event, FSF_AZ_TX_EV_WQ_FF_FULL)) {
 		/* Rewrite the FIFO write pointer */
 		tx_ev_q_label = EF4_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL);
-		tx_queue = ef4_channel_get_tx_queue(
-			channel, tx_ev_q_label % EF4_TXQ_TYPES);
+		tx_queue = channel->tx_queue +
+			(tx_ev_q_label % EF4_TXQ_TYPES);
 
 		netif_tx_lock(efx->net_dev);
 		ef4_farch_notify_tx_desc(tx_queue);
-- 
2.34.1


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

end of thread, other threads:[~2025-09-08 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05  3:07 [PATCH] sfc: farch: Potential Null Pointer Dereference in ef4_farch_handle_tx_event() Chen Yufeng
2025-09-08 12:51 ` Edward Cree

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).