* [PATCH v3] tg3: Avoid NULL pointer dereference in netif_device_attach()
@ 2020-10-21 7:38 Defang Bo
2020-10-21 17:23 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Defang Bo @ 2020-10-21 7:38 UTC (permalink / raw)
To: siva.kallam; +Cc: prashant, mchan, davem, kuba, netdev, linux-kernel, Defang Bo
Similar to commit<1b0ff89852d7>("tg3: Avoid NULL pointer dereference in tg3_io_error_detected()")
This patch avoids NULL pointer dereference add a check for netdev being NULL on tg3_resume().
Signed-off-by: Defang Bo <bodefang@126.com>
---
drivers/net/ethernet/broadcom/tg3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index ae756dd..345c6aa 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -18099,7 +18099,7 @@ static int tg3_resume(struct device *device)
rtnl_lock();
- if (!netdev || !netif_running(dev))
+ if (!dev || !netif_running(dev))
goto unlock;
netif_device_attach(dev);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] tg3: Avoid NULL pointer dereference in netif_device_attach()
2020-10-21 7:38 [PATCH v3] tg3: Avoid NULL pointer dereference in netif_device_attach() Defang Bo
@ 2020-10-21 17:23 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-10-21 17:23 UTC (permalink / raw)
To: Defang Bo; +Cc: siva.kallam, prashant, mchan, davem, netdev, linux-kernel
On Wed, 21 Oct 2020 15:38:09 +0800 Defang Bo wrote:
> Similar to commit<1b0ff89852d7>("tg3: Avoid NULL pointer dereference in tg3_io_error_detected()")
> This patch avoids NULL pointer dereference add a check for netdev being NULL on tg3_resume().
>
> Signed-off-by: Defang Bo <bodefang@126.com>
Are you actually hitting this error or can otherwise prove it may
happen?
PCIe error handlers could reasonably happen asynchronously during
probe, but suspend/resume getting called on a device that wasn't fully
probed sounds like something that should be prevented by the bus.
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index ae756dd..345c6aa 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -18099,7 +18099,7 @@ static int tg3_resume(struct device *device)
>
> rtnl_lock();
>
> - if (!netdev || !netif_running(dev))
> + if (!dev || !netif_running(dev))
> goto unlock;
>
> netif_device_attach(dev);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-21 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 7:38 [PATCH v3] tg3: Avoid NULL pointer dereference in netif_device_attach() Defang Bo
2020-10-21 17:23 ` Jakub Kicinski
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).