Patch "net: page_pool: add missing free_percpu when page_pool_init fail" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: page_pool: add missing free_percpu when page_pool_init fail

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-page_pool-add-missing-free_percpu-when-page_pool.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5cec707c9ccc79245df88eeca0631c16b1b8d2a7
Author: Jian Shen <shenjian15@xxxxxxxxxx>
Date:   Mon Oct 30 17:12:56 2023 +0800

    net: page_pool: add missing free_percpu when page_pool_init fail
    
    [ Upstream commit 8ffbd1669ed1d58939d6e878dffaa2f60bf961a4 ]
    
    When ptr_ring_init() returns failure in page_pool_init(), free_percpu()
    is not called to free pool->recycle_stats, which may cause memory
    leak.
    
    Fixes: ad6fa1e1ab1b ("page_pool: Add recycle stats")
    Signed-off-by: Jian Shen <shenjian15@xxxxxxxxxx>
    Signed-off-by: Jijie Shao <shaojijie@xxxxxxxxxx>
    Reviewed-by: Yunsheng Lin <linyunsheng@xxxxxxxxxx>
    Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxx>
    Reviewed-by: Somnath Kotur <somnath.kotur@xxxxxxxxxxxx>
    Reviewed-by: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231030091256.2915394-1-shaojijie@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index a3e12a61d456c..1ed4affd9149f 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -210,8 +210,12 @@ static int page_pool_init(struct page_pool *pool,
 		return -ENOMEM;
 #endif
 
-	if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0)
+	if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) {
+#ifdef CONFIG_PAGE_POOL_STATS
+		free_percpu(pool->recycle_stats);
+#endif
 		return -ENOMEM;
+	}
 
 	atomic_set(&pool->pages_state_release_cnt, 0);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux