From: Mathieu Desnoyers Date: Tue, 31 Oct 2017 22:23:59 +0000 (-0400) Subject: Fix: lttng-logger get_user_pages_fast error handling X-Git-Tag: v2.9.6~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=16c2a31e89abf6f63840af7d31da68c5f8fab9a5;p=lttng-modules.git Fix: lttng-logger get_user_pages_fast error handling Comparing a signed return value against an unsigned nr_pages performs the comparison as "unsigned", and therefore mistakenly considers get_user_pages_fast() errors as success. By passing an invalid pointer to write() to the /proc/lttng-logger interface, unprivileged user-space processes can trigger a kernel OOPS. Signed-off-by: Mathieu Desnoyers --- diff --git a/probes/lttng.c b/probes/lttng.c index 8810fa22..09045fac 100644 --- a/probes/lttng.c +++ b/probes/lttng.c @@ -65,7 +65,7 @@ static ssize_t lttng_logger_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { - unsigned int nr_pages = 1, i; + int nr_pages = 1, i; unsigned long uaddr = (unsigned long) user_buf; struct page *pages[2]; ssize_t written;