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]
Unified · Split
| @@ -1285,11 +1285,10 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring, · 1284 unmodified lines | ||
| 1285 | 1285 | { |
| 1286 | 1286 | struct iavf_rx_buffer *rx_buffer; |
| 1287 | 1287 | |
| 1288 | − if (!size) | |
| 1289 | − return NULL; | |
| 1290 | − | |
| 1291 | 1288 | rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean]; |
| 1292 | 1289 | prefetchw(rx_buffer->page); |
| 1290 | + if (!size) | |
| 1291 | + return rx_buffer; | |
| 1293 | 1292 | |
| 1294 | 1293 | /* we are reusing so sync this buffer for CPU use */ |
| 1295 | 1294 | dma_sync_single_range_for_cpu(rx_ring->dev, |