Patch "ipvs: fix WARNING in __ip_vs_cleanup_batch()" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ipvs: fix WARNING in __ip_vs_cleanup_batch()

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ipvs-fix-warning-in-__ip_vs_cleanup_batch.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 23441039e1a682ff792bfad6e03d751fb4a40eb8
Author: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
Date:   Mon Oct 31 20:07:04 2022 +0800

    ipvs: fix WARNING in __ip_vs_cleanup_batch()
    
    [ Upstream commit 3d00c6a0da8ddcf75213e004765e4a42acc71d5d ]
    
    During the initialization of ip_vs_conn_net_init(), if file ip_vs_conn
    or ip_vs_conn_sync fails to be created, the initialization is successful
    by default. Therefore, the ip_vs_conn or ip_vs_conn_sync file doesn't
    be found during the remove.
    
    The following is the stack information:
    name 'ip_vs_conn_sync'
    WARNING: CPU: 3 PID: 9 at fs/proc/generic.c:712
    remove_proc_entry+0x389/0x460
    Modules linked in:
    Workqueue: netns cleanup_net
    RIP: 0010:remove_proc_entry+0x389/0x460
    Call Trace:
    <TASK>
    __ip_vs_cleanup_batch+0x7d/0x120
    ops_exit_list+0x125/0x170
    cleanup_net+0x4ea/0xb00
    process_one_work+0x9bf/0x1710
    worker_thread+0x665/0x1080
    kthread+0x2e4/0x3a0
    ret_from_fork+0x1f/0x30
    </TASK>
    
    Fixes: 61b1ab4583e2 ("IPVS: netns, add basic init per netns.")
    Signed-off-by: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
    Acked-by: Julian Anastasov <ja@xxxxxx>
    Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 5ebc7998529a..51679d1e2d7d 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1378,20 +1378,36 @@ int __net_init ip_vs_conn_net_init(struct netns_ipvs *ipvs)
 {
 	atomic_set(&ipvs->conn_count, 0);
 
-	proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net,
-			&ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state));
-	proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net,
-			&ip_vs_conn_sync_seq_ops,
-			sizeof(struct ip_vs_iter_state));
+#ifdef CONFIG_PROC_FS
+	if (!proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net,
+			     &ip_vs_conn_seq_ops,
+			     sizeof(struct ip_vs_iter_state)))
+		goto err_conn;
+
+	if (!proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net,
+			     &ip_vs_conn_sync_seq_ops,
+			     sizeof(struct ip_vs_iter_state)))
+		goto err_conn_sync;
+#endif
+
 	return 0;
+
+#ifdef CONFIG_PROC_FS
+err_conn_sync:
+	remove_proc_entry("ip_vs_conn", ipvs->net->proc_net);
+err_conn:
+	return -ENOMEM;
+#endif
 }
 
 void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs)
 {
 	/* flush all the connection entries first */
 	ip_vs_conn_flush(ipvs);
+#ifdef CONFIG_PROC_FS
 	remove_proc_entry("ip_vs_conn", ipvs->net->proc_net);
 	remove_proc_entry("ip_vs_conn_sync", ipvs->net->proc_net);
+#endif
 }
 
 int __init ip_vs_conn_init(void)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux