Commit 949fafcd authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

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: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220607104946.18710-16-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cb47d81f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -813,7 +813,8 @@ int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
	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;
}