History

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]

Przemyslaw Patynowski committed 4 years ago

Commit a9f49e01 parent 4635fd31 file · +2 −3Browse files

Unified · Split

drivers/net/ethernet/intel/iavf/iavf_txrx.c+2−3
@@ -1285,11 +1285,10 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring, · 1284 unmodified lines
1285{1285{
1286 struct iavf_rx_buffer *rx_buffer;1286 struct iavf_rx_buffer *rx_buffer;
1287 1287
1288 if (!size)
1289 return NULL;
1290
1291 rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];1288 rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];
1292 prefetchw(rx_buffer->page);1289 prefetchw(rx_buffer->page);
1290 if (!size)
1291 return rx_buffer;
1293 1292
1294 /* we are reusing so sync this buffer for CPU use */1293 /* we are reusing so sync this buffer for CPU use */
1295 dma_sync_single_range_for_cpu(rx_ring->dev,1294 dma_sync_single_range_for_cpu(rx_ring->dev,