[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1603106567-4589-1-git-send-email-bodefang@126.com>
Date: Mon, 19 Oct 2020 19:22:47 +0800
From: Defang Bo <bodefang@....com>
To: siva.kallam@...adcom.com, prashant@...adcom.com,
mchan@...adcom.com, davem@...emloft.net, kuba@...nel.org
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Defang Bo <bodefang@....com>
Subject: [PATCH] tg3: Avoid NULL pointer dereference in netif_device_attach()
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@....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 ebff1fc..ae756dd 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 (!netif_running(dev))
+ if (!netdev || !netif_running(dev))
goto unlock;
netif_device_attach(dev);
--
1.9.1
Powered by blists - more mailing lists