Skip to content

Commit 7b51161

Browse files
Yang Yinglianggregkh
authored andcommitted
firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe()
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: 1e7c573 ("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>
1 parent 3127a86 commit 7b51161

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/firmware/raspberrypi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ static int rpi_firmware_probe(struct platform_device *pdev)
272272
int ret = PTR_ERR(fw->chan);
273273
if (ret != -EPROBE_DEFER)
274274
dev_err(dev, "Failed to get mbox channel: %d\n", ret);
275+
kfree(fw);
275276
return ret;
276277
}
277278

0 commit comments

Comments
 (0)