]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: airoha: Do not read uninitialized fragment address in airoha_dev_xmit()
authorLorenzo Bianconi <lorenzo@kernel.org>
Fri, 24 Apr 2026 09:00:28 +0000 (11:00 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 28 Apr 2026 00:40:11 +0000 (17:40 -0700)
commitbde34e84edc8b5571fbde7e941e175a4293ee1eb
tree580b381d9e7406506f17a00c72d38d11066e1544
parente070aac63b42bf81f4dc565f9f841ff47e6c992f
net: airoha: Do not read uninitialized fragment address in airoha_dev_xmit()

The transmit loop in airoha_dev_xmit() reads fragment address and length
during its final iteration, when the loop index equals
skb_shinfo(skb)->nr_frags, at which point the fragment data is
uninitialized. While these values are never consumed, the read itself is
unsafe and may trigger a page fault. Fix this by avoiding the fragment
read on the last iteration.
Additionally, move the skb pointer from the first to the last used packet
descriptor, so that airoha_qdma_tx_napi_poll() defers freeing the skb
until the final descriptor is processed.

Fixes: 23020f0493270 ("net: airoha: Introduce ethernet support for EN7581 SoC")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260424-airoha-xmit-fix-read-frag-v1-1-fdc0a83c79e8@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/airoha/airoha_eth.c