net: mvpp2: check return value after calling platform_get_resource()
Subsystems (3)
PATCH 1/1 net: mvpp2: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
Signed-off-by Yang Yingliang <[email protected]>
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +4 -0
@@ -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'
Signature · 1 line
2.25.1
This patch was applied to netdev/net-next.git (refs/heads/master):
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
Quoted 7 lines · 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 <[email protected]>--- 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