[lkml]   [2020]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH net] hinic: fix rewaking txq after netif_tx_disable
When calling hinic_close in hinic_set_channels, all queues are
stopped after netif_tx_disable, but some queue may be rewaken in
free_tx_poll by mistake while drv is handling tx irq. If one queue
is rewaken core may call hinic_xmit_frame to send pkt after
netif_tx_disable within a short time which may results in accessing
memory that has been already freed in hinic_close. So we judge
whether the netdev is in down state before waking txq in free_tx_poll
to fix this bug.

Signed-off-by: Luo bin <>
drivers/net/ethernet/huawei/hinic/hinic_tx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
index a97498ee6914..6eac6bdf164e 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c
@@ -718,7 +718,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget)

__netif_tx_lock(netdev_txq, smp_processor_id());

- netif_wake_subqueue(nic_dev->netdev, qp->q_id);
+ if (nic_dev->flags & HINIC_INTF_UP)
+ netif_wake_subqueue(nic_dev->netdev, qp->q_id);


 \ /
  Last update: 2020-09-07 19:14    [W:0.047 / U:1.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site