mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: pfcp: allocate per-cpu tstats for PFCP netdevs
@ 2026-06-05 15:13 Samuel Moelius
  2026-06-09  1:01 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Moelius @ 2026-06-05 15:13 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Samuel Moelius, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, open list:NETWORKING DRIVERS, open list

PFCP uses dev_get_tstats64() as its ndo_get_stats64 callback, but
pfcp_link_setup() does not request NETDEV_PCPU_STAT_TSTATS.  The net
core therefore leaves dev->tstats NULL for PFCP devices.

Creating a PFCP rtnetlink device can immediately ask the new netdev for
stats while building the RTM_NEWLINK notification.  That reaches
dev_get_tstats64() and dereferences the NULL dev->tstats pointer.

Set pcpu_stat_type to NETDEV_PCPU_STAT_TSTATS during PFCP link setup so
the net core allocates the storage expected by dev_get_tstats64().

Assisted-by: Codex:gpt-5.5-cyber-preview
Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
---
 drivers/net/pfcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/pfcp.c b/drivers/net/pfcp.c
index 28e6bc4a1f14..a6aa30ae0af7 100644
--- a/drivers/net/pfcp.c
+++ b/drivers/net/pfcp.c
@@ -148,6 +148,7 @@ static void pfcp_link_setup(struct net_device *dev)
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
 	dev->priv_flags |= IFF_NO_QUEUE;
 
+	dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
 	netif_keep_dst(dev);
 }
 
-- 
2.43.0


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

* Re: [PATCH] net: pfcp: allocate per-cpu tstats for PFCP netdevs
  2026-06-05 15:13 [PATCH] net: pfcp: allocate per-cpu tstats for PFCP netdevs Samuel Moelius
@ 2026-06-09  1:01 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2026-06-09  1:01 UTC (permalink / raw)
  To: Samuel Moelius
  Cc: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	open list:NETWORKING DRIVERS, open list

On Fri, Jun 5, 2026 at 8:13 AM Samuel Moelius
<sam.moelius@trailofbits.com> wrote:
>
> PFCP uses dev_get_tstats64() as its ndo_get_stats64 callback, but
> pfcp_link_setup() does not request NETDEV_PCPU_STAT_TSTATS.  The net
> core therefore leaves dev->tstats NULL for PFCP devices.
>
> Creating a PFCP rtnetlink device can immediately ask the new netdev for
> stats while building the RTM_NEWLINK notification.  That reaches
> dev_get_tstats64() and dereferences the NULL dev->tstats pointer.
>
> Set pcpu_stat_type to NETDEV_PCPU_STAT_TSTATS during PFCP link setup so
> the net core allocates the storage expected by dev_get_tstats64().
>
> Assisted-by: Codex:gpt-5.5-cyber-preview
> Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
> ---
>  drivers/net/pfcp.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/pfcp.c b/drivers/net/pfcp.c
> index 28e6bc4a1f14..a6aa30ae0af7 100644
> --- a/drivers/net/pfcp.c
> +++ b/drivers/net/pfcp.c
> @@ -148,6 +148,7 @@ static void pfcp_link_setup(struct net_device *dev)
>         dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
>         dev->priv_flags |= IFF_NO_QUEUE;
>
> +       dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
>         netif_keep_dst(dev);
>  }
>

We request Fixes: tags in networking tree.

Please look at Documentation/process/maintainer-netdev.rst

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

end of thread, other threads:[~2026-06-09  1:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 15:13 [PATCH] net: pfcp: allocate per-cpu tstats for PFCP netdevs Samuel Moelius
2026-06-09  1:01 ` Eric Dumazet

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

all inboxes | Powered by JetHome®