* [PATCH net] sfc: Do not free an empty page_ring
@ 2022-04-04 10:48 Martin Habets
2022-04-04 12:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Martin Habets @ 2022-04-04 10:48 UTC (permalink / raw)
To: kuba, pabeni, davem; +Cc: netdev, ap420073, ecree.xilinx
When the page_ring is not used page_ptr_mask is 0.
Do not dereference page_ring[0] in this case.
Fixes: 2768935a4660 ("sfc: reuse pages to avoid DMA mapping/unmapping costs")
Reported-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
---
drivers/net/ethernet/sfc/rx_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c
index 1b22c7be0088..fa8b9aacca11 100644
--- a/drivers/net/ethernet/sfc/rx_common.c
+++ b/drivers/net/ethernet/sfc/rx_common.c
@@ -150,6 +150,9 @@ static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue)
struct efx_nic *efx = rx_queue->efx;
int i;
+ if (unlikely(!rx_queue->page_ring))
+ return;
+
/* Unmap and release the pages in the recycle ring. Remove the ring. */
for (i = 0; i <= rx_queue->page_ptr_mask; i++) {
struct page *page = rx_queue->page_ring[i];
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] sfc: Do not free an empty page_ring
2022-04-04 10:48 [PATCH net] sfc: Do not free an empty page_ring Martin Habets
@ 2022-04-04 12:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-04 12:00 UTC (permalink / raw)
To: Martin Habets; +Cc: kuba, pabeni, davem, netdev, ap420073, ecree.xilinx
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Mon, 04 Apr 2022 11:48:51 +0100 you wrote:
> When the page_ring is not used page_ptr_mask is 0.
> Do not dereference page_ring[0] in this case.
>
> Fixes: 2768935a4660 ("sfc: reuse pages to avoid DMA mapping/unmapping costs")
> Reported-by: Taehee Yoo <ap420073@gmail.com>
> Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
>
> [...]
Here is the summary with links:
- [net] sfc: Do not free an empty page_ring
https://git.kernel.org/netdev/net/c/458f5d92df48
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-04 12:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-04 10:48 [PATCH net] sfc: Do not free an empty page_ring Martin Habets
2022-04-04 12:00 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.