* [PATCH net-next] net: mvpp2: check return value after calling platform_get_resource()
@ 2021-06-07 14:36 Yang Yingliang
2021-06-07 21:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-06-07 14:36 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: mw, davem, kuba
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index d4fb620f53f3..b0066f64be98 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -7377,6 +7377,10 @@ static int mvpp2_probe(struct platform_device *pdev)
return PTR_ERR(priv->lms_base);
} else {
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ if (!res) {
+ dev_err(&pdev->dev, "Invalid resource\n");
+ return -EINVAL;
+ }
if (has_acpi_companion(&pdev->dev)) {
/* In case the MDIO memory region is declared in
* the ACPI, it can already appear as 'in-use'
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: mvpp2: check return value after calling platform_get_resource()
2021-06-07 14:36 [PATCH net-next] net: mvpp2: check return value after calling platform_get_resource() Yang Yingliang
@ 2021-06-07 21:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-07 21:10 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, netdev, mw, davem, kuba
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Mon, 7 Jun 2021 22:36:02 +0800 you wrote:
> It will cause null-ptr-deref if platform_get_resource() returns NULL,
> we need check the return value.
>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++++
> 1 file changed, 4 insertions(+)
Here is the summary with links:
- [net-next] net: mvpp2: check return value after calling platform_get_resource()
https://git.kernel.org/netdev/net-next/c/0bb51a3a3857
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-07 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 14:36 [PATCH net-next] net: mvpp2: check return value after calling platform_get_resource() Yang Yingliang
2021-06-07 21:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.