netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] ibmvnic: Fix TX skb leak after device reset
@ 2024-06-20 15:23 Nick Child
  2024-06-20 15:23 ` [PATCH net 1/2] ibmvnic: Add tx check to prevent skb leak Nick Child
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Nick Child @ 2024-06-20 15:23 UTC (permalink / raw)
  To: netdev; +Cc: nick.child, haren, ricklind, Nick Child

These 2 patches focus on resolving a possible skb leak after
a subset of the ibmvnic reset processes.

Essentially, the driver maintains a free_map which contains indexes to a
list of tracked skb's addresses on xmit. Due to a mistake during reset,
the free_map did not accurately map to free indexes in the skb list.
This resulted in a leak in skb because the index in free_map was blindly
trusted to contain a NULL pointer. So this patchset addresses 2 issues:
  1. We shouldn't blindly trust our free_map (lets not do this again)
  2. We need to ensure that our free_map is accurate in the first place

The first patch is more cautionary to detect these leaks in any future
bugs (while also helping to justify the leak fixed in the second patch).
In this case it is due to device resets which free the tx complete irq
but do not free the outstanding skb's which would have been freed by the
irq handler ibmvnic_complete_tx().

These outstanding SKB's MUST be freed any time we free the IRQ. We are
not going to get an IRQ to free them later on! Also, further in the
reset path init_tx_pools() is going to mark all buffers free! This is
addressed by the second patch.

Nick Child (2):
  ibmvnic: Add tx check to prevent skb leak
  ibmvnic: Free any outstanding tx skbs during scrq reset

 drivers/net/ethernet/ibm/ibmvnic.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

-- 
2.39.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-25  9:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 15:23 [PATCH net 0/2] ibmvnic: Fix TX skb leak after device reset Nick Child
2024-06-20 15:23 ` [PATCH net 1/2] ibmvnic: Add tx check to prevent skb leak Nick Child
2024-06-25  8:58   ` Paolo Abeni
2024-06-20 15:23 ` [PATCH net 2/2] ibmvnic: Free any outstanding tx skbs during scrq reset Nick Child
2024-06-22 10:40 ` [PATCH net 0/2] ibmvnic: Fix TX skb leak after device reset patchwork-bot+netdevbpf
2024-06-25  9:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).