From ab51a3b7ce8090feb7d45a0e7f0210e2345183f1 Mon Sep 17 00:00:00 2001 From: Cole Dishington Date: Thu, 1 Aug 2024 12:27:59 +1200 Subject: [PATCH] Fix crash when viewing nat46 kernel module config In the commit 91b8e68 Add network namespace awareness to nat46 the network namespace of the /proc/net file is now passed via single_open() to nat46_proc_show(). However, the priv arg passed to single_open() is accessed via the seq_file, not the second value. When using the second value, the 'network namespace' is invalid and causes a kernel oops. Access the network namespace in nat46_proc_show from struct seq_file. --- nat46/modules/nat46-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nat46/modules/nat46-module.c b/nat46/modules/nat46-module.c index 8b3be8c..f4720d4 100644 --- a/nat46/modules/nat46-module.c +++ b/nat46/modules/nat46-module.c @@ -94,7 +94,7 @@ static int nat46_proc_show(struct seq_file *m, void *v) { struct net *net; - net = (struct net *)v; + net = (struct net *)m->private; nat64_show_all_configs(net, m); return 0; }