netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] net: page_pool: check page pool ethtool stats
@ 2023-10-01 11:41 Sven Auhagen
  2023-10-02 19:46 ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Sven Auhagen @ 2023-10-01 11:41 UTC (permalink / raw)
  To: netdev
  Cc: thomas.petazzoni, hawk, lorenzo, Paulo.DaSilva, ilias.apalodimas,
	mcroce

If the page_pool variable is null while passing it to
the page_pool_get_stats function we receive a kernel error.

Check if the page_pool variable is at least valid.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Reported-by: Paulo Da Silva <Paulo.DaSilva@kyberna.com>

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 2396c99bedea..4c5dca6b4a16 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -65,6 +65,9 @@ bool page_pool_get_stats(struct page_pool *pool,
 	if (!stats)
 		return false;
 
+	if (!pool)
+		return false;
+
 	/* The caller is responsible to initialize stats. */
 	stats->alloc_stats.fast += pool->alloc_stats.fast;
 	stats->alloc_stats.slow += pool->alloc_stats.slow;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-30 14:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-01 11:41 [PATCH v2 1/2] net: page_pool: check page pool ethtool stats Sven Auhagen
2023-10-02 19:46 ` Jakub Kicinski
2023-10-03  4:12   ` Sven Auhagen
2023-10-25  5:59   ` Ilias Apalodimas
2023-10-25  7:53     ` Leon Romanovsky
2023-10-30  9:39       ` Sven Auhagen
2023-10-30 14:23         ` Leon Romanovsky
2023-10-30 14:42           ` Sven Auhagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).