Closed cgzones closed 2 years ago
Hi @cgzones,
I believe the issue is that selinux_sb_eat_lsm_opts()
generates a standalone string label from the mount option using kmemdup_nul()
and never frees that memory after the call to selinux_add_opt()
. I'm guessing something like the following should work, want to give it a try?
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index beceb89f68d9..3cfaf8bbd14d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2600,10 +2600,10 @@ static int selinux_sb_eat_lsm_opts(char *options, void >
}
}
rc = selinux_add_opt(token, arg, mnt_opts);
- if (unlikely(rc)) {
- kfree(arg);
+ kfree(arg);
+ arg = NULL;
+ if (unlikely(rc))
goto free_opt;
- }
} else {
if (!first) { // copy with preceding comma
from--;
Version: 5.19.0-rc2
After running the SELinux testsuite: