linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Defang Bo <bodefang@126.com>
To: siva.kallam@broadcom.com
Cc: prashant@broadcom.com, mchan@broadcom.com, davem@davemloft.net,
	kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Defang Bo <bodefang@126.com>
Subject: [PATCH v2] tg3: Avoid NULL pointer dereference in netif_device_attach()
Date: Wed, 21 Oct 2020 15:33:22 +0800	[thread overview]
Message-ID: <1603265602-8887-1-git-send-email-bodefang@126.com> (raw)

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


                 reply	other threads:[~2020-10-21  7:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1603265602-8887-1-git-send-email-bodefang@126.com \
    --to=bodefang@126.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=prashant@broadcom.com \
    --cc=siva.kallam@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).