[Devel] [PATCH RH9 04/26] connector: use device stored in VE

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Oct 7 15:53:44 MSK 2021


From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

Instead of global static device.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry picked from vz8 commit a7339fcffcb28a9c161438561e885833af237c6b)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/connector/connector.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 8d184588d53e..e2af22d7a4ee 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -27,13 +27,11 @@ MODULE_AUTHOR("Evgeniy Polyakov <zbr at ioremap.net>");
 MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector.");
 MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_CONNECTOR);
 
-static struct cn_dev cdev;
-
 static int cn_already_initialized;
 
 static struct cn_dev *get_cdev(struct ve_struct *ve)
 {
-	return &cdev;
+	return &ve->cn->cdev;
 }
 
 /*
@@ -251,7 +249,7 @@ static int __maybe_unused cn_proc_show(struct seq_file *m, void *v)
 
 static int cn_init_ve(struct ve_struct *ve)
 {
-	struct cn_dev *dev = get_cdev(get_ve0());
+	struct cn_dev *dev;
 	struct netlink_kernel_cfg cfg = {
 		.groups	= CN_NETLINK_USERS + 0xf,
 		.input	= cn_rx_skb,
@@ -263,6 +261,8 @@ static int cn_init_ve(struct ve_struct *ve)
 	if (!ve->cn)
 		return -ENOMEM;
 
+	dev = &ve->cn->cdev;
+
 	/*
 	 * This is a hook, hooks are called under a single lock, so ve_ns will
 	 * not disappear, so rcu_read_lock()/unlock is not needed here.
-- 
2.31.1



More information about the Devel mailing list