[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190507124113.GA659@amd>
Date: Tue, 7 May 2019 14:41:13 +0200
From: Pavel Machek <pavel@...x.de>
To: alexander.shishkin@...ux.intel.com, security@...nel.org,
sasha.levin@...cle.com, gregkh@...uxfoundation.org,
kernel list <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...l.org>, trivial@...nel.org
Subject: stm class: Prevent user-controllable allocations
It seems to me that we still allow overflow if count == ~0. We'll then
allocate 0 bytes but copy ~0 bytes. That does not sound healthy.
Fixes: f08b18266c7116e2ec6885dd53a928f580060a71
Signed-off-by: Pavel Machek <pavel@...x.de>
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index c7ba8ac..8846fca 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -631,7 +631,7 @@ static ssize_t stm_char_write(struct file *file, const char __user *buf,
char *kbuf;
int err;
- if (count + 1 > PAGE_SIZE)
+ if (count > PAGE_SIZE - 1)
count = PAGE_SIZE - 1;
/*
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists