Skip to contentSkip to conversation

net: llc: make empty have static storage duration

PATCH Applied Wentao Guan 4 participants 4 messages Jun 16 – Jun 19

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: llc: make empty have static storage duration

Make empty have static storage duration (like net/sysctl_net.c does) to avoid a potential use-after-return and keep consistent with __register_sysctl_table @table 'should not be free'd after registration'.

Fixes 73dbd8cf7947 ("net: Remove ctl_table sentinel elements from several networking subsystems")
---
 net/llc/sysctl_net_llc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/llc/sysctl_net_llc.c +1 -1
index c8d88e2508fce..15f1e5d88f208 100644
@@ -47,7 +47,7 @@ static struct ctl_table_header *llc_station_header;
 
 int __init llc_sysctl_init(void)
 {
-	struct ctl_table empty[1] = {};
+	static struct ctl_table empty[1] = {};
 	llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
 	llc_station_header = register_net_sysctl_sz(&init_net, "net/llc/station", empty, 0);
 
Signature · 1 line
2.30.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Wentao Guan

Make empty have static storage duration (like net/sysctl_net.c does) to avoid a potential use-after-return and keep consistent with __register_sysctl_table @table 'should not be free'd after registration'.

Fixes 73dbd8cf7947 ("net: Remove ctl_table sentinel elements from several networking subsystems")
maintainer
#2 lore raw
In reply to Wentao Guan
Quoted 15 lines · On Tue, 16 Jun 2026 14:40:53 +0800 Wentao Guan wrote:

Make empty have static storage duration (like net/sysctl_net.c does) to avoid a potential use-after-return and keep consistent with __register_sysctl_table @table 'should not be free'd after registration'.

Fixes 73dbd8cf7947 ("net: Remove ctl_table sentinel elements from several networking subsystems")
---
 net/llc/sysctl_net_llc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/llc/sysctl_net_llc.c +0 -0
index c8d88e2508fce..15f1e5d88f208 100644

net/llc/sysctl_net_llc.c static struct ctl_table_header *llc_station_header; · line 52

Quoted 7 lines
net/llc/sysctl_net_llc.c +1 -1
@@ -47,7 +47,7 @@ static struct ctl_table_header *llc_station_header;
 
 int __init llc_sysctl_init(void)
 {
-	struct ctl_table empty[1] = {};
+	static struct ctl_table empty[1] = {};
 	llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
 	llc_station_header = register_net_sysctl_sz(&init_net, "net/llc/station", empty, 0);

I will apply this but it's not a bug.

The size is 0, even tho the pointer is stored there can be no access.

#3 lore raw
In reply to Wentao Guan
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 16 Jun 2026 14:40:53 +0800 you wrote:

Make empty have static storage duration (like net/sysctl_net.c does) to avoid a potential use-after-return and keep consistent with __register_sysctl_table @table 'should not be free'd after registration'.

Fixes 73dbd8cf7947 ("net: Remove ctl_table sentinel elements from several networking subsystems")

[...]

Here is the summary with links:
- [net] net: llc: make empty have static storage duration

    https://git.kernel.org/netdev/net/c/d31deeab707b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html