]> www.infradead.org Git - users/hch/misc.git/commitdiff
Input: uinput - zero-initialize uinput_ff_upload_compat to avoid info leak
authorZhen Ni <zhen.ni@easystack.cn>
Sun, 28 Sep 2025 06:37:37 +0000 (14:37 +0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 29 Sep 2025 04:29:03 +0000 (21:29 -0700)
Struct ff_effect_compat is embedded twice inside
uinput_ff_upload_compat, contains internal padding. In particular, there
is a hole after struct ff_replay to satisfy alignment requirements for
the following union member. Without clearing the structure,
copy_to_user() may leak stack data to userspace.

Initialize ff_up_compat to zero before filling valid fields.

Fixes: 2d56f3a32c0e ("Input: refactor evdev 32bit compat to be shareable with uinput")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Link: https://lore.kernel.org/r/20250928063737.74590-1-zhen.ni@easystack.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/uinput.c

index 2c51ea9d01d7777ea4ec5dd98350e47fbab5b337..13336a2fd49c8a20b496db59e4ee9678a9051401 100644 (file)
@@ -775,6 +775,7 @@ static int uinput_ff_upload_to_user(char __user *buffer,
        if (in_compat_syscall()) {
                struct uinput_ff_upload_compat ff_up_compat;
 
+               memset(&ff_up_compat, 0, sizeof(ff_up_compat));
                ff_up_compat.request_id = ff_up->request_id;
                ff_up_compat.retval = ff_up->retval;
                /*