diff options
| author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-07-06 08:52:39 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-19 12:22:39 +0200 |
| commit | 32e060927351e4e7116949dd1067f9a504c303ce (patch) | |
| tree | 6eccdc353289f5d5bb7035695b9ae0e2ad782424 /security | |
| parent | 502dfc5875bab9ae5d6a2939146c2c5e5683be40 (diff) | |
| download | linux-32e060927351e4e7116949dd1067f9a504c303ce.tar.gz linux-32e060927351e4e7116949dd1067f9a504c303ce.tar.bz2 linux-32e060927351e4e7116949dd1067f9a504c303ce.zip | |
smackfs: Prevent underflow in smk_set_cipso()
[ Upstream commit 3ad49d37cf5759c3b8b68d02e3563f633d9c1aee ]
There is a upper bound to "catlen" but no lower bound to prevent
negatives. I don't see that this necessarily causes a problem but we
may as well be safe.
Fixes: e114e473771c ("Smack: Simplified Mandatory Access Control Kernel")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
| -rw-r--r-- | security/smack/smackfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 658eab05599e..27fd7744e0fc 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -895,7 +895,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, } ret = sscanf(rule, "%d", &catlen); - if (ret != 1 || catlen > SMACK_CIPSO_MAXCATNUM) + if (ret != 1 || catlen < 0 || catlen > SMACK_CIPSO_MAXCATNUM) goto out; if (format == SMK_FIXED24_FMT && |
