From: Edward Cree <ecree.xilinx@gmail.com>
To: Chen Yufeng <chenyufeng@iie.ac.cn>
Cc: kuba@kernel.org, linux@treblig.org, netdev@vger.kernel.org
Subject: Re: [PATCH] sfc: farch: Potential Null Pointer Dereference in ef4_farch_handle_tx_event()
Date: Mon, 8 Sep 2025 13:51:56 +0100 [thread overview]
Message-ID: <609b35a8-ebb1-44dd-9a33-0eb1257021cf@gmail.com> (raw)
In-Reply-To: <20250905030737.220-1-chenyufeng@iie.ac.cn>
On 05/09/2025 04:07, Chen Yufeng wrote:
> 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>
This patch doesn't make sense; ef4_channel_get_tx_queue expands to
&channel->tx_queue[type], which is an equivalent expression to the
channel->tx_queue + type you're replacing it with.
Where do you think a NULL comes from, and why do you think this fixes it?
-Ed
> ---
> 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);
prev parent reply other threads:[~2025-09-08 12:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=609b35a8-ebb1-44dd-9a33-0eb1257021cf@gmail.com \
--to=ecree.xilinx@gmail.com \
--cc=chenyufeng@iie.ac.cn \
--cc=kuba@kernel.org \
--cc=linux@treblig.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).