]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ena: Fix incorrect descriptor free behavior
authorDavid Arinzon <darinzon@amazon.com>
Wed, 10 Apr 2024 09:13:57 +0000 (09:13 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 11 Apr 2024 09:21:02 +0000 (11:21 +0200)
commitbf02d9fe00632d22fa91d34749c7aacf397b6cde
treea0fb859205ace7037fea61c77de5266023c90841
parentf7e417180665234fdb7af2ebe33d89aaa434d16f
net: ena: Fix incorrect descriptor free behavior

ENA has two types of TX queues:
- queues which only process TX packets arriving from the network stack
- queues which only process TX packets forwarded to it by XDP_REDIRECT
  or XDP_TX instructions

The ena_free_tx_bufs() cycles through all descriptors in a TX queue
and unmaps + frees every descriptor that hasn't been acknowledged yet
by the device (uncompleted TX transactions).
The function assumes that the processed TX queue is necessarily from
the first category listed above and ends up using napi_consume_skb()
for descriptors belonging to an XDP specific queue.

This patch solves a bug in which, in case of a VF reset, the
descriptors aren't freed correctly, leading to crashes.

Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David Arinzon <darinzon@amazon.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/amazon/ena/ena_netdev.c