]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 17 Nov 2022 07:06:36 +0000 (15:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:36:05 +0000 (11:36 +0200)
commit1c7b77acfa4f60c29f938da67864579730843a11
treef432bd1ee86dd96daa7bf7c0adf8a2162d0163b4
parent8c283a0f0665c6d07f08b8b67b035bb0333894d5
firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe()

commit 7b51161696e803fd5f9ad55b20a64c2df313f95c upstream.

In rpi_firmware_probe(), if mbox_request_channel() fails, the 'fw' will
not be freed through rpi_firmware_delete(), fix this leak by calling
kfree() in the error path.

Fixes: 2284abf319f5 ("firmware: raspberrypi: Keep count of all consumers")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221117070636.3849773-1-yangyingliang@huawei.com
Acked-by: Joel Savitz <jsavitz@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/raspberrypi.c