提交 7b511616 编写于 作者: Y Yang Yingliang 提交者: Greg Kroah-Hartman

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: 1e7c5735 ("firmware: raspberrypi: Keep count of all consumers")
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221117070636.3849773-1-yangyingliang@huawei.comAcked-by: NJoel Savitz <jsavitz@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3127a86a
...@@ -272,6 +272,7 @@ static int rpi_firmware_probe(struct platform_device *pdev) ...@@ -272,6 +272,7 @@ static int rpi_firmware_probe(struct platform_device *pdev)
int ret = PTR_ERR(fw->chan); int ret = PTR_ERR(fw->chan);
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
dev_err(dev, "Failed to get mbox channel: %d\n", ret); dev_err(dev, "Failed to get mbox channel: %d\n", ret);
kfree(fw);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册