Re: [PATCH v2] posix-timers: Fix potential memory leak in do_timer_create()

From: Frederic Weisbecker

Date: Fri Nov 14 2025 - 08:52:15 EST


Le Fri, Nov 14, 2025 at 02:27:39PM +0200, Eslam Khafagy a écrit :
> potential memory leak may happen if user space pointer created_timer_id
> is invallid. or the value it points to is invalid. the call will
> prematurely return.
> However it doesn't free the memory it allocates with
> alloc_posix_timer(). This patch attempts to fix that by moving parameter
> check before alloc_posix_timer().
>
> Reported-by: syzbot+9c47ad18f978d4394986@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/all/69155df4.a70a0220.3124cb.0017.GAE@xxxxxxxxxx/T/
> Fixes: ec2d0c04624b3 ("posix-timers: Provide a mechanism to allocate a given timer ID")
> Suggested-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
> Signed-off-by: Eslam Khafagy <eslam.medhat1993@xxxxxxxxx>

Reviewed-by: Frederic Weisbecker <frederic@xxxxxxxxxx>

--
Frederic Weisbecker
SUSE Labs