public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat•com>
To: netdev@vger•kernel.org
Cc: Wei Yang <weiyang@linux•vnet.ibm.com>,
	Gavin Shan <shangw@linux•vnet.ibm.com>,
	Nithin Nayak Sujir <nsujir@broadcom•com>,
	"David S. Miller" <davem@davemloft•net>
Subject: Re: net/tg3: Fix kernel crash
Date: Tue, 6 Aug 2013 10:46:10 -0400	[thread overview]
Message-ID: <20130806144610.GA2889@redhat.com> (raw)
In-Reply-To: <20130731204019.059F66609B7@gitolite.kernel.org>

On Wed, Jul 31, 2013 at 08:40:18PM +0000, Linux Kernel wrote:
 > Gitweb:     http://git.kernel.org/linus/;a=commit;h=d8af4dfd84329015e18ea3d83a84c46e92f21020
 > Commit:     d8af4dfd84329015e18ea3d83a84c46e92f21020
 > Parent:     d738ce8fdc05ebf5b1475f8ae26d908c8c50970b
 > Author:     Gavin Shan <shangw@linux•vnet.ibm.com>
 > AuthorDate: Wed Jul 24 17:25:08 2013 +0800
 > 
 >     net/tg3: Fix kernel crash
 >     
 >     While EEH error happens, we might not have network device instance
 >     (struct net_device) yet. So we can't access the instance safely and
 >     check its link state, which causes kernel crash. The patch fixes it.
 >     Reported-by: Wei Yang <weiyang@linux•vnet.ibm.com>
 >     Signed-off-by: Gavin Shan <shangw@linux•vnet.ibm.com>
 >     Acked-by: Nithin Nayak Sujir <nsujir@broadcom•com>
 >     Signed-off-by: David S. Miller <davem@davemloft•net>
 > 
 > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
 > index d964f30..aee1b9a 100644
 > --- a/drivers/net/ethernet/broadcom/tg3.c
 > +++ b/drivers/net/ethernet/broadcom/tg3.c
 > @@ -17773,7 +17773,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
 >  
 >  	rtnl_lock();
 >  
 > -	if (!netif_running(netdev))
 > +	/* We probably don't have netdev yet */
 > +	if (!netdev || !netif_running(netdev))
 >  		goto done;
 
This looks incomplete.  'done' does this..

done:
  if (state == pci_channel_io_perm_failure) {
          tg3_napi_enable(tp);
          dev_close(netdev);


If netdev is null, we'll deref it in dev_close.

	Dave

           reply	other threads:[~2013-08-06 14:46 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20130731204019.059F66609B7@gitolite.kernel.org>]

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=20130806144610.GA2889@redhat.com \
    --to=davej@redhat$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nsujir@broadcom$(echo .)com \
    --cc=shangw@linux$(echo .)vnet.ibm.com \
    --cc=weiyang@linux$(echo .)vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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