]> git.hungrycats.org Git - linux/commit
Fix memory leak in posix_clock_open()
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 26 Mar 2024 21:59:48 +0000 (14:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:42 +0000 (15:11 +0200)
commita88649b49523e8cbe95254440d803e38c19d2341
tree0dc635adac7b63eb5264c3fead78c77dd0b0e3cd
parent80f4a03823798fd0a7bf04ee93db4b8d3ba8ad44
Fix memory leak in posix_clock_open()

commit 5b4cdd9c5676559b8a7c944ac5269b914b8c0bb8 upstream.

If the clk ops.open() function returns an error, we don't release the
pccontext we allocated for this clock.

Re-organize the code slightly to make it all more obvious.

Reported-by: Rohit Keshri <rkeshri@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Fixes: 60c6946675fc ("posix-clock: introduce posix_clock_context concept")
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/time/posix-clock.c