]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clocksource/drivers/bcm2835_timer: Fix memory leak of timer
authorColin Ian King <colin.king@canonical.com>
Thu, 19 Dec 2019 21:32:46 +0000 (21:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:28 +0000 (08:36 +0100)
commitc7fc72092134e93d016ff36a00aef3cd68298c01
tree676ceb6d385f4e7bf5bf8c5615a3b28de701c7cb
parent9f0414eed212464a2b90e38e9f6e3f38dd322395
clocksource/drivers/bcm2835_timer: Fix memory leak of timer

[ Upstream commit 2052d032c06761330bca4944bb7858b00960e868 ]

Currently when setup_irq fails the error exit path will leak the
recently allocated timer structure.  Originally the code would
throw a panic but a later commit changed the behaviour to return
via the err_iounmap path and hence we now have a memory leak. Fix
this by adding a err_timer_free error path that kfree's timer.

Addresses-Coverity: ("Resource Leak")
Fixes: 524a7f08983d ("clocksource/drivers/bcm2835_timer: Convert init function to return error")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20191219213246.34437-1-colin.king@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clocksource/bcm2835_timer.c