diff options
author | Dave Jones <davej@redhat.com> | 2014-04-07 18:39:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:36:10 -0400 |
commit | 16caed319604609a5579df132fce362a456170d7 (patch) | |
tree | 4957342fcb459c2821297167362616ed38ce202c /fs | |
parent | b06dd879f5db33c1d7f5ab516ea671627f99c0c9 (diff) |
fault-injection: set bounds on what /proc/self/make-it-fail accepts.
/proc/self/make-it-fail is a boolean, but accepts any number, including
negative ones. Change variable to unsigned, and cap upper bound at 1.
[akpm@linux-foundation.org: don't make make_it_fail unsigned]
Signed-off-by: Dave Jones <davej@fedoraproject.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 8da60e768b42..6b7087e2e8fb 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1236,6 +1236,9 @@ static ssize_t proc_fault_inject_write(struct file * file, | |||
1236 | make_it_fail = simple_strtol(strstrip(buffer), &end, 0); | 1236 | make_it_fail = simple_strtol(strstrip(buffer), &end, 0); |
1237 | if (*end) | 1237 | if (*end) |
1238 | return -EINVAL; | 1238 | return -EINVAL; |
1239 | if (make_it_fail < 0 || make_it_fail > 1) | ||
1240 | return -EINVAL; | ||
1241 | |||
1239 | task = get_proc_task(file_inode(file)); | 1242 | task = get_proc_task(file_inode(file)); |
1240 | if (!task) | 1243 | if (!task) |
1241 | return -ESRCH; | 1244 | return -ESRCH; |