[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190531013350.GA4642@zhanggen-UX430UQ>
Date: Fri, 31 May 2019 09:33:50 +0800
From: Gen Zhang <blackgod016574@...il.com>
To: paul@...l-moore.com, sds@...ho.nsa.gov, eparis@...isplace.org
Cc: selinux@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org, omosnace@...hat.com
Subject: [PATCH v2] hooks: fix a missing-check bug in
selinux_sb_eat_lsm_opts()
In selinux_sb_eat_lsm_opts(), 'arg' is allocated by kmemdup_nul(). It
returns NULL when fails. So 'arg' should be checked.
Signed-off-by: Gen Zhang <blackgod016574@...il.com>
Reviewed-by: Ondrej Mosnacek <omosnace@...hat.com>
Fixes: 99dbbb593fe6 ("selinux: rewrite selinux_sb_eat_lsm_opts()")
---
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 3ec702c..5a9e959 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2635,6 +2635,8 @@ static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts)
*q++ = c;
}
arg = kmemdup_nul(arg, q - arg, GFP_KERNEL);
+ if (!arg)
+ return -ENOMEM;
}
rc = selinux_add_opt(token, arg, mnt_opts);
if (unlikely(rc)) {
Powered by blists - more mailing lists