Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: page_pool: check nla_nest_start() return value in page_pool_nl_stats_fill()
@ 2026-05-26  6:51 Zhao Dongdong
  2026-05-26 16:04 ` Alexander Lobakin
  0 siblings, 1 reply; 4+ messages in thread
From: Zhao Dongdong @ 2026-05-26  6:51 UTC (permalink / raw)
  To: davem, edumazet, pabeni; +Cc: netdev, Zhao Dongdong

From: Zhao Dongdong <zhaodongdong@kylinos.cn>

nla_nest_start() can return NULL if the skb runs out of space.
page_pool_nl_stats_fill() does not check the return value before
calling nla_nest_end(), which can lead to a NULL pointer dereference.
Add a NULL check after nla_nest_start() and abort the message if it fails.

Fixes: d49010adae73 ("net: page_pool: expose page pool stats via netlink")
Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
---
 net/core/page_pool_user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c
index ee5060d8eec0..2e41691251e1 100644
--- a/net/core/page_pool_user.c
+++ b/net/core/page_pool_user.c
@@ -127,6 +127,8 @@ page_pool_nl_stats_fill(struct sk_buff *rsp, const struct page_pool *pool,
 		return -EMSGSIZE;
 
 	nest = nla_nest_start(rsp, NETDEV_A_PAGE_POOL_STATS_INFO);
+	if (!nest)
+		goto err_cancel_msg;
 
 	if (nla_put_uint(rsp, NETDEV_A_PAGE_POOL_ID, pool->user.id) ||
 	    (pool->slow.netdev->ifindex != LOOPBACK_IFINDEX &&
-- 
2.25.1


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

end of thread, other threads:[~2026-05-27  7:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26  6:51 [PATCH] net: page_pool: check nla_nest_start() return value in page_pool_nl_stats_fill() Zhao Dongdong
2026-05-26 16:04 ` Alexander Lobakin
2026-05-26 23:27   ` Jakub Kicinski
2026-05-27  7:51     ` [PATCH] net: page_pool: check nla_nest_start() return value in Zhao Dongdong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox