diff mbox series

[SRU,J,5/9] ipc: Use the same namespace to modify and validate

Message ID 20240321121457.362921-6-thibault.ferrante@canonical.com
State New
Headers show
Series ipc/msg: mitigate the lock contention with percpu counter | expand

Commit Message

Thibault Ferrante March 21, 2024, 12:14 p.m. UTC
From: Alexey Gladkov <legion@kernel.org>

BugLink: https://bugs.launchpad.net/bugs/2058485

In the 1f5c135ee509 ("ipc: Store ipc sysctls in the ipc namespace") I
missed that in addition to the modification of sem_ctls[3], the change
is validated. This validation must occur in the same namespace.

Link: https://lore.kernel.org/lkml/875ymnvryb.fsf@email.froward.int.ebiederm.org/
Fixes: 1f5c135ee509 ("ipc: Store ipc sysctls in the ipc namespace")
Signed-off-by: Alexey Gladkov <legion@kernel.org>
Link: https://lkml.kernel.org/r/b3cb9a25cce6becbef77186bc1216071a08a969b.1651584847.git.legion@kernel.org
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
(cherry picked from commit def7343ff03bbb36ce7a34dcb19cab599f0da446)
Signed-off-by: Thibault Ferrante <thibault.ferrante@canonical.com>
---
 ipc/ipc_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index 15210ac47e9e1..d1d5204cf5893 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -68,7 +68,7 @@  static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
 	ret = proc_dointvec(table, write, buffer, lenp, ppos);
 
 	if (!ret)
-		ret = sem_check_semmni(current->nsproxy->ipc_ns);
+		ret = sem_check_semmni(ns);
 
 	/*
 	 * Reset the semmni value if an error happens.