Skip to content

Commit a9f49e0

Browse files
Kaaameanguy11
authored andcommitted
iavf: Fix handling of dummy receive descriptors
Fix memory leak caused by not handling dummy receive descriptor properly. iavf_get_rx_buffer now sets the rx_buffer return value for dummy receive descriptors. Without this patch, when the hardware writes a dummy descriptor, iavf would not free the page allocated for the previous receive buffer. This is an unlikely event but can still happen. [Jesse: massaged commit message] Fixes: efa14c3 ("iavf: allow null RX descriptors") Signed-off-by: Przemyslaw Patynowski <[email protected]> Signed-off-by: Jesse Brandeburg <[email protected]> Tested-by: Konrad Jankowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 4635fd3 commit a9f49e0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,11 +1285,10 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring,
12851285
{
12861286
struct iavf_rx_buffer *rx_buffer;
12871287

1288-
if (!size)
1289-
return NULL;
1290-
12911288
rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];
12921289
prefetchw(rx_buffer->page);
1290+
if (!size)
1291+
return rx_buffer;
12931292

12941293
/* we are reusing so sync this buffer for CPU use */
12951294
dma_sync_single_range_for_cpu(rx_ring->dev,

0 commit comments

Comments
 (0)