VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Jeremy Cline <jcline@redhat.com> 2018-07-31 01:37:31 +0000 committer: Jan Kara <jack@suse.cz> 2018-08-22 18:17:48 +0200 commit: 7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1 parent: 64d9d13828c6c8e188bba63794eee923df3d69a9
Commit Summary:
fs/quota: Fix spectre gadget in do_quotactl
Diffstat:
1 file changed, 2 insertions, 0 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index d403392d8a0f..f0cbf58ad4da 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -18,6 +18,7 @@
 #include <linux/quotaops.h>
 #include <linux/types.h>
 #include <linux/writeback.h>
+#include <linux/nospec.h>
 
 static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 				     qid_t id)
@@ -701,6 +702,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 
 	if (type >= MAXQUOTAS)
 		return -EINVAL;
+	type = array_index_nospec(type, MAXQUOTAS);
 	/*
 	 * Quota not supported on this fs? Check this before s_quota_types
 	 * since they needn't be set if quota is not supported at all.