[PATCH net v2 0/2] net: spacemit: A few error handling fixes
From: Vivian Wang
Date: Thu Mar 05 2026 - 01:41:21 EST
Recently a user reported a supposed UAF/double-free in this driver. It
turned out to be a false positive (ugh) from a bug with riscv's
kfence_protect_page() [1], but it did also prompt me to review the
driver code yet again. These are some fixes for error handling problems
that I've found.
[1]: https://lore.kernel.org/r/20260303-handle-kfence-protect-spurious-fault-v2-0-f80d8354d79d@xxxxxxxxxxx/
---
Changes in v2:
- Retarget to net (Andrew, Jakub)
- Drop what was patch 1 and patch 4 for now, since they are code cleanup
only and can't affect users (Andrew, Jakub)
- Reworded cover letter
- Link to v1: https://lore.kernel.org/r/20260303-k1-ethernet-more-fixes-v1-0-0ab0122fdd14@xxxxxxxxxxx
---
Vivian Wang (2):
net: spacemit: Fix error handling in emac_alloc_rx_desc_buffers()
net: spacemit: Fix error handling in emac_tx_mem_map()
drivers/net/ethernet/spacemit/k1_emac.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260303-k1-ethernet-more-fixes-1829c3717cfe
Best regards,
--
Vivian "dramforever" Wang