>Hmm. So it seems like currently, when we managed to properly copy from zc >the 'normal' page and redirect failed, we would interpret this as (based >on ice implementation, not sure about other zc drivers) ICE_XDP_CONSUMED >which would do another xsk_buff_free() which would be a no-op on this >xdp_buff at this point but 'normal' page would indeed leak?
Yes, that's my understanding too. xdp_convert_zc_to_xdp_frame() puts the ZC buffer back on the free list right after the copy, and when __xdp_do_redirect_frame() then fails nothing frees the copied frame, so that page leaks. On ice the following xsk_buff_free() for ICE_XDP_CONSUMED is a no-op, since xp_free() skips a buffer that is already on the free list. That only works because ice frees right away, before anything else is allocated from the pool. Drivers that release the buffer later, like mlx5 on Rx WQE refill, can still free a buffer that has been handed out again in the meantime, the same way as on the XSKMAP path. If the copy itself fails, the ZC buffer is not freed and the driver frees it once, so that case is fine. In short, for failed __xdp_do_redirect_frame(): - the copied page leaks, in every ZC driver - the ZC buffer is freed twice, which is harmless when the driver frees it right away (ice, i40e, ...) but can corrupt the pool when it frees it later (e.g. mlx5). The patch does not affect that path.
