summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorCasey Schaufler <casey@schaufler-ca.com>2020-04-09 16:35:28 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-17 16:40:36 +0200
commit9c09a772acb4d2e23f2be059b873e3e200848794 (patch)
tree99c60f59201878da757ca387fa70a2ace7903f07 /security
parentb5c8896bc14f54e5c4dd5a6e42879f125b8abd2d (diff)
downloadlinux-stable-9c09a772acb4d2e23f2be059b873e3e200848794.tar.gz
linux-stable-9c09a772acb4d2e23f2be059b873e3e200848794.tar.bz2
linux-stable-9c09a772acb4d2e23f2be059b873e3e200848794.zip
Smack: slab-out-of-bounds in vsscanf
commit 84e99e58e8d1e26f04c097f4266e431a33987f36 upstream. Add barrier to soob. Return -EOVERFLOW if the buffer is exceeded. Suggested-by: Hillf Danton <hdanton@sina.com> Reported-by: syzbot+bfdd4a2f07be52351350@syzkaller.appspotmail.com Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/smack/smackfs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index e3e05c04dbd1..c21b656b3263 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -878,11 +878,21 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
else
rule += strlen(skp->smk_known) + 1;
+ if (rule > data + count) {
+ rc = -EOVERFLOW;
+ goto out;
+ }
+
ret = sscanf(rule, "%d", &maplevel);
if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL)
goto out;
rule += SMK_DIGITLEN;
+ if (rule > data + count) {
+ rc = -EOVERFLOW;
+ goto out;
+ }
+
ret = sscanf(rule, "%d", &catlen);
if (ret != 1 || catlen > SMACK_CIPSO_MAXCATNUM)
goto out;