Skip to content

ibmvnic: Fix TX skb leak after device reset

Nick Child netdev 1 version Applied

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2ibmvnic: Add tx check to prevent skb leakdrivers/net/ethernet/ibm/ibmvnic.c+12 -01 replyApplied
2/2ibmvnic: Free any outstanding tx skbs during scrq resetdrivers/net/ethernet/ibm/ibmvnic.c+6 -00 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net 0/2] ibmvnic: Fix TX skb leak after device reset

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(+)
Signature · 1 line
2.39.3