Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3a5ee13 authored by Kangjie Lu's avatar Kangjie Lu Committed by Greg Kroah-Hartman
Browse files

net: marvell: fix a missing check of acpi_match_device



[ Upstream commit 92ee77d148bf06d8c52664be4d1b862583fd5c0e ]

When acpi_match_device fails, its return value is NULL. Directly using
the return value without a check may result in a NULL-pointer
dereference. The fix checks if acpi_match_device fails, and if so,
returns -EINVAL.

Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6d98c426
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5132,6 +5132,8 @@ static int mvpp2_probe(struct platform_device *pdev)
	if (has_acpi_companion(&pdev->dev)) {
		acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
					    &pdev->dev);
		if (!acpi_id)
			return -EINVAL;
		priv->hw_version = (unsigned long)acpi_id->driver_data;
	} else {
		priv->hw_version =