From: Teng Peisen From: Fan Gong In hinic3_configure_rxqs(), the check for hinic3_rx_fill_buffers() only verifies that at least one buffer was allocated (!pkts). If memory allocation partially fails during RX queue setup, the function incorrectly treats a partially populated RX ring as successful, which may cause RX queue instability or unexpected packet drops at runtime. Fix this by tightening the condition to 'pkts < rxq->q_mask'. This ensures that RX queue configuration fails with -ENOMEM unless the RX ring is completely filled as expected. Fixes: b83bb584bc97 ("hinic3: Tx & Rx configuration") Co-developed-by: Teng Peisen Signed-off-by: Teng Peisen Signed-off-by: Fan Gong --- drivers/net/ethernet/huawei/hinic3/hinic3_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c index 309ab5901379..389b1c2158be 100644 --- a/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_rx.c @@ -541,7 +541,7 @@ int hinic3_configure_rxqs(struct net_device *netdev, u16 num_rq, rq_associate_cqes(rxq); pkts = hinic3_rx_fill_buffers(rxq); - if (!pkts) { + if (pkts < rxq->q_mask) { netdev_err(netdev, "Failed to fill Rx buffer\n"); return -ENOMEM; } -- 2.54.0