[Devel] [PATCH RHEL8 COMMIT] tty/vt: check allocation size in con_set_unimap()
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Jun 16 10:11:57 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.43
------>
commit 7f30a5255d380e892badfc32b2daa7826e117028
Author: Denis Efremov <efremov at linux.com>
Date: Wed Jun 16 10:11:57 2021 +0300
tty/vt: check allocation size in con_set_unimap()
The vmemdup_user() function has no 2-factor argument form. Use array_size()
to check for the overflow.
Signed-off-by: Denis Efremov <efremov at linux.com>
Reviewed-by: Kees Cook <keescook at chromium.org>
Link: https://lore.kernel.org/r/20200603102804.2110817-1-efremov@linux.com
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Commit 5de30b286e7166164f9e45de991bde26f5db8298 in the mainline kernel.
It is a follow-up for ms commit fa2b360f261e "tty/vt: avoid high order pages
allocation on GIO_UNIMAP ioctl" and is nice to have in VZ8 too.
Added to VZ8 in the scope of https://jira.sw.ru/browse/PSBM-127844.
Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
---
drivers/tty/vt/consolemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index b28aa0d289f8..32acea9e8270 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -542,7 +542,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
if (!ct)
return 0;
- unilist = vmemdup_user(list, ct * sizeof(struct unipair));
+ unilist = vmemdup_user(list, array_size(sizeof(struct unipair), ct));
if (IS_ERR(unilist))
return PTR_ERR(unilist);
More information about the Devel
mailing list