summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorLinus Torvalds2019-07-27 04:13:38 +0200
committerLinus Torvalds2019-07-27 04:13:38 +0200
commit40233e7c447367ffc615b524187970732848d5e3 (patch)
treef21626c0722b660902ddfadef62cb122203b1a84 /security
parentMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/... (diff)
parentselinux: check sidtab limit before adding a new entry (diff)
downloadkernel-qcow2-linux-40233e7c447367ffc615b524187970732848d5e3.tar.gz
kernel-qcow2-linux-40233e7c447367ffc615b524187970732848d5e3.tar.xz
kernel-qcow2-linux-40233e7c447367ffc615b524187970732848d5e3.zip
Merge tag 'selinux-pr-20190726' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore: "One small SELinux patch to add some proper bounds/overflow checking when adding a new sid/secid" * tag 'selinux-pr-20190726' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: check sidtab limit before adding a new entry
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/sidtab.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index e63a90ff2728..1f0a6eaa2d6a 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -286,6 +286,11 @@ static int sidtab_reverse_lookup(struct sidtab *s, struct context *context,
++count;
}
+ /* bail out if we already reached max entries */
+ rc = -EOVERFLOW;
+ if (count >= SIDTAB_MAX)
+ goto out_unlock;
+
/* insert context into new entry */
rc = -ENOMEM;
dst = sidtab_do_lookup(s, count, 1);