]> git.proxmox.com Git - mirror_ubuntu-kernels.git/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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 27 Mar 2024 16:03:22 +0000 (09:03 -0700)
commit5b4cdd9c5676559b8a7c944ac5269b914b8c0bb8
tree394cf2ade2125b28bb736387704c1e9c37aeca67
parent7033999ecd7b8cf9ea59265035a0150961e023ee
Fix memory leak in posix_clock_open()

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>
kernel/time/posix-clock.c