Skip to content

Commit d3366a0

Browse files
nizhen-tdtor
authored andcommitted
Input: uinput - zero-initialize uinput_ff_upload_compat to avoid info leak
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: 2d56f3a ("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>
1 parent 52e06d5 commit d3366a0

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/input/misc/uinput.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ static int uinput_ff_upload_to_user(char __user *buffer,
775775
if (in_compat_syscall()) {
776776
struct uinput_ff_upload_compat ff_up_compat;
777777

778+
memset(&ff_up_compat, 0, sizeof(ff_up_compat));
778779
ff_up_compat.request_id = ff_up->request_id;
779780
ff_up_compat.retval = ff_up->retval;
780781
/*

0 commit comments

Comments
 (0)