From: Dave Jones Date: Mon, 7 Apr 2014 22:39:15 +0000 (-0700) Subject: fault-injection: set bounds on what /proc/self/make-it-fail accepts. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16caed319604609a5579df132fce362a456170d7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Akinobu Mita Cc: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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, 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;