[PATCH] sysctl: Fix mq permission check

From: Alexey Gladkov
Date: Wed Oct 05 2022 - 13:08:05 EST


The kernel test robot found a typo that causes mq_permissions() to return a
useless value.

Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>
Link: https://lore.kernel.org/r/202210052100.86dbb00a-yujie.liu@xxxxxxxxx
Fixes: 7608b6a72ed0 ("sysctl: Allow to change limits for posix messages queues")
Signed-off-by: Alexey Gladkov <legion@xxxxxxxxxx>
---
ipc/mq_sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
index ff1054fbbacc..ce03930aced5 100644
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -102,7 +102,7 @@ static int mq_permissions(struct ctl_table_header *head, struct ctl_table *table
if (uid_eq(current_euid(), ns_root_uid))
mode >>= 6;

- if (in_egroup_p(ns_root_gid))
+ else if (in_egroup_p(ns_root_gid))
mode >>= 3;

mode &= 7;
--
2.33.4