From: Jiri Slaby Date: Tue, 7 Jun 2022 10:49:26 +0000 (+0200) Subject: tty/vt: consolemap: check put_user() in con_get_unimap() X-Git-Tag: v6.0-rc1~64^2~164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=949fafcd7fa310e68bfd8828304150cdc9de5629;p=thirdparty%2Fkernel%2Flinux.git tty/vt: consolemap: check put_user() in con_get_unimap() Only the return value of copy_to_user() is checked in con_get_unimap(). Do the same for put_user() of the count too. Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220607104946.18710-16-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index 831450f2bfd1d..92b5dddb00d98 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c @@ -813,7 +813,8 @@ unlock: console_unlock(); if (copy_to_user(list, unilist, min(ect, ct) * sizeof(*unilist))) ret = -EFAULT; - put_user(ect, uct); + if (put_user(ect, uct)) + ret = -EFAULT; kvfree(unilist); return ret ? ret : (ect <= ct) ? 0 : -ENOMEM; }