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

From: Eslam Khafagy

Date: Fri Nov 14 2025 - 06:53:49 EST



On 11/14/25 11:29, Cyrill Gorcunov wrote:
On Fri, Nov 14, 2025 at 07:06:21AM +0200, Eslam Khafagy wrote:
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 attemps to fix that.

Reported-and-tested-by: syzbot+9c47ad18f978d4394986@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://lore.kernel.org/all/69155df4.a70a0220.3124cb.0017.GAE@xxxxxxxxxx/T/
Fixes: ec2d0c04624b3c8a7eb1682e006717fa20cfbe24 ("posix-timers: Provide a mechanism to allocate a given timer ID")
Signed-off-by: Eslam Khafagy <eslam.medhat1993@xxxxxxxxx>
Simply move parameters check _before_ new timer allocation please, this way you won't
need new code at all :)

:)
v2 coming right up.