提交 939edf33 编写于 作者: M Martin Habets 提交者: Zheng Zengkai

sfc: Do not free an empty page_ring

stable inclusion
from stable-v5.10.111
commit d8992b393f974b47c4a72b9bacdbfc4110e29eea
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5GL1Z

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d8992b393f974b47c4a72b9bacdbfc4110e29eea

--------------------------------

[ Upstream commit 458f5d92 ]

When the page_ring is not used page_ptr_mask is 0.
Do not dereference page_ring[0] in this case.

Fixes: 2768935a ("sfc: reuse pages to avoid DMA mapping/unmapping costs")
Reported-by: NTaehee Yoo <ap420073@gmail.com>
Signed-off-by: NMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 12babfa3
...@@ -166,6 +166,9 @@ static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue) ...@@ -166,6 +166,9 @@ static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue)
struct efx_nic *efx = rx_queue->efx; struct efx_nic *efx = rx_queue->efx;
int i; int i;
if (unlikely(!rx_queue->page_ring))
return;
/* Unmap and release the pages in the recycle ring. Remove the ring. */ /* Unmap and release the pages in the recycle ring. Remove the ring. */
for (i = 0; i <= rx_queue->page_ptr_mask; i++) { for (i = 0; i <= rx_queue->page_ptr_mask; i++) {
struct page *page = rx_queue->page_ring[i]; struct page *page = rx_queue->page_ring[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册