Skip to content

Commit

Permalink
fault-injection: set bounds on what /proc/self/make-it-fail accepts.
Browse files Browse the repository at this point in the history
/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.

[[email protected]: don't make make_it_fail unsigned]
Signed-off-by: Dave Jones <[email protected]>
Reviewed-by: Akinobu Mita <[email protected]>
Cc: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Dave Jones authored and torvalds committed Apr 7, 2014
1 parent b06dd87 commit 16caed3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,9 @@ static ssize_t proc_fault_inject_write(struct file * file,
make_it_fail = simple_strtol(strstrip(buffer), &end, 0);
if (*end)
return -EINVAL;
if (make_it_fail < 0 || make_it_fail > 1)
return -EINVAL;

task = get_proc_task(file_inode(file));
if (!task)
return -ESRCH;
Expand Down

0 comments on commit 16caed3

Please sign in to comment.