linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: fix a potential NULL pointer dereference
@ 2019-03-23  3:39 Kangjie Lu
  2019-03-26  0:15 ` David Miller
       [not found] ` <0f518f7a-ff1f-b8d9-8468-a1f7648ada46@codeaurora.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Kangjie Lu @ 2019-03-23  3:39 UTC (permalink / raw)
  To: kjlu
  Cc: Alexandre Torgue, netdev, linux-kernel, linux-stm32, Jose Abreu,
	Maxime Coquelin, pakki001, Giuseppe Cavallaro, David S. Miller,
	linux-arm-kernel

In case of_device_get_match_data fails, the fix return -EINVAL
to avoid the NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 3256e5cbad27..344ead5949b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -485,6 +485,8 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev)
 	int err;
 
 	data = of_device_get_match_data(&pdev->dev);
+	if (!data)
+		return -EINVAL;
 
 	err = stmmac_dvr_remove(&pdev->dev);
 	if (err < 0)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] net: stmmac: fix a potential NULL pointer dereference
@ 2019-03-12  7:32 Kangjie Lu
  2019-03-12  8:28 ` Chen-Yu Tsai
  2019-03-27 13:42 ` Mukesh Ojha
  0 siblings, 2 replies; 6+ messages in thread
From: Kangjie Lu @ 2019-03-12  7:32 UTC (permalink / raw)
  To: kjlu
  Cc: Alexandre Torgue, netdev, linux-kernel, linux-stm32, Jose Abreu,
	Maxime Coquelin, pakki001, Giuseppe Cavallaro, David S. Miller,
	linux-arm-kernel

In case of_device_get_match_data fails, the fix return -ENOMEM
to avoid the NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 3256e5cbad27..344ead5949b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -485,6 +485,8 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev)
 	int err;
 
 	data = of_device_get_match_data(&pdev->dev);
+	if (!data)
+		return -EINVAL;
 
 	err = stmmac_dvr_remove(&pdev->dev);
 	if (err < 0)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-27 13:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-23  3:39 [PATCH] net: stmmac: fix a potential NULL pointer dereference Kangjie Lu
2019-03-26  0:15 ` David Miller
     [not found] ` <0f518f7a-ff1f-b8d9-8468-a1f7648ada46@codeaurora.org>
2019-03-26 19:50   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2019-03-12  7:32 Kangjie Lu
2019-03-12  8:28 ` Chen-Yu Tsai
2019-03-27 13:42 ` Mukesh Ojha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).