[PATCH v2 net 0/3] net: hns3: three fixes for hns3 driver
From: Jijie Shao
Date: Wed Oct 21 2026 - 08:30:35 EST
This series contains three bug fixes for the HNS3 driver.
Patch 1 fixes a vector resource leak in the error path of
hns3_nic_alloc_vector_data, where a devm_kcalloc failure after
successful get_vector() leaves allocated vectors unreleased.
Patch 2 fixes an interface stall that occurs when the hardware RX
queue is full and memory allocation fails. Without an RX interrupt,
NAPI is never scheduled and the queue cannot drain. A delayed work
re-arms NAPI polling on affected vectors to break the deadlock.
Patch 3 fixes a use-after-free in debugfs read callbacks that can
access priv->ring and ring->desc while reset, driver unload, or
ethtool ring resize is freeing those resources. A mutex is added
to synchronize debugfs readers against resource teardown.
---
Changes in v2:
Patch 1:
- No change.
Patch 2:
- Clear per-vector OOM bitmap when device is DOWN to avoid
spurious napi_schedule() on next up event.
- Move rx_oom_cnt accounting to hns3_ring_set_oom_state() with
test_and_set_bit() for per-event counting.
Patch 3:
- Drop hclge_debugfs.c changes; mutex only protects enet-layer.
- Replace guard(mutex) with explicit mutex_lock/unlock.
- Remove redundant NULL checks; unify -EPERM to -EBUSY.
v1: https://lore.kernel.org/all/20260915132434.1141742-1-shaojijie@xxxxxxxxxx/
---
Jijie Shao (3):
net: hns3: fix vector resource leak in hns3_nic_alloc_vector_data
net: hns3: fix interface stuck after OOM with full hardware rx queue
net: hns3: fix use-after-free in debugfs read during reset/unload
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 +
.../ethernet/hisilicon/hns3/hns3_debugfs.c | 124 +++++++++++--------
.../net/ethernet/hisilicon/hns3/hns3_enet.c | 70 +++++++++-
.../net/ethernet/hisilicon/hns3/hns3_enet.h | 18 +++
.../ethernet/hisilicon/hns3/hns3_ethtool.c | 3 +
5 files changed, 167 insertions(+), 49 deletions(-)
base-commit: 305deb54c6c287e586bed92da2375ae1220e8dde
--
2.43.0