* [PATCH] net: marvell: fix a missing check of acpi_match_device
@ 2018-12-26 6:31 Kangjie Lu
2018-12-28 0:27 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26 6:31 UTC (permalink / raw
To: kjlu
Cc: pakki001, David S. Miller, Antoine Tenart, Maxime Chevallier,
Yan Markman, netdev, linux-kernel
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: Kangjie Lu <kjlu@umn.edu>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index f1dab0b55769..c9444346475b 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5255,6 +5255,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 =
--
2.17.2 (Apple Git-113)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: marvell: fix a missing check of acpi_match_device
2018-12-26 6:31 [PATCH] net: marvell: fix a missing check of acpi_match_device Kangjie Lu
@ 2018-12-28 0:27 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-12-28 0:27 UTC (permalink / raw
To: kjlu
Cc: pakki001, antoine.tenart, maxime.chevallier, ymarkman, netdev,
linux-kernel
From: Kangjie Lu <kjlu@umn.edu>
Date: Wed, 26 Dec 2018 00:31:08 -0600
> 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: Kangjie Lu <kjlu@umn.edu>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-28 0:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26 6:31 [PATCH] net: marvell: fix a missing check of acpi_match_device Kangjie Lu
2018-12-28 0:27 ` David Miller
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.