Messages in this thread Patch in this message | | | Date | Mon, 4 Nov 2019 19:33:57 +0100 (CET) | From | Nicolas Pitre <> | Subject | Re: Bug report - slab-out-of-bounds in vcs_scr_readw |
| |
On Mon, 4 Nov 2019, Or Cohen wrote:
> @gregkh@linuxfoundation.org @nico@fluxnic.net - Thanks for the quick response. > @gregkh@linuxfoundation.org - Regarding your question, I don't think > the 1 byte buffer is related to the problem. ( it's just was there in > the initial reproducer the fuzzer created, and I forgot to remove it > while reducing code from the reproducer ).
I think I know what the problem is. I have no time to test it though.
Please try this (untested) patch. Also please try running the same test code but with vcsa6 in addition to vcsu6 to be sure.
---------- >8 Subject: [PATCH] vcs: add missing validation on vcs_size() returned value
One usage instance didn't account for the fact that vcs_size() may return a negative error code.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 1f042346e7..fa07d79027 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -474,6 +474,10 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) goto unlock_out; size = vcs_size(inode); + if (size < 0) { + ret = size; + goto unlock_out; + } ret = -EINVAL; if (pos < 0 || pos > size) goto unlock_out;
| |