From: David Miller <davem@davemloft.net>
To: nhorman@tuxdriver.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] netconsole: fix deadlock when removing net driver that netconsole is using (v2)
Date: Fri, 22 Apr 2011 11:40:33 -0700 (PDT) [thread overview]
Message-ID: <20110422.114033.104072820.davem@davemloft.net> (raw)
In-Reply-To: <1303495859-12279-1-git-send-email-nhorman@tuxdriver.com>
From: Neil Horman <nhorman@tuxdriver.com>
Date: Fri, 22 Apr 2011 14:10:59 -0400
> @@ -683,9 +684,16 @@ static int netconsole_netdev_event(struct notifier_block *this,
> * rtnl_lock already held
> */
> if (nt->np.dev) {
> + spin_unlock_irqrestore(
> + &target_list_lock,
> + flags);
> __netpoll_cleanup(&nt->np);
> + spin_lock_irqsave(&target_list_lock,
> + flags);
> dev_put(nt->np.dev);
> nt->np.dev = NULL;
> + netconsole_target_put(nt);
> + goto restart;
If you drop the lock here, another cpu can put the device and set it
to NULL.
In which case you'll double release when you regrab the lock here.
Too bad you can't NULL out the device before dropping the lock,
because that way would be able to ensure you'd be the only releaser.
But that won't work because __netpoll_cleanup() wants the device
pointer to be set.
Hmmm...
next prev parent reply other threads:[~2011-04-22 18:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-22 14:06 [PATCH] netconsole: prevent deadlock when removing net driver that netconsole is using Neil Horman
2011-04-22 14:44 ` Neil Horman
2011-04-22 18:10 ` [PATCH] netconsole: fix deadlock when removing net driver that netconsole is using (v2) Neil Horman
2011-04-22 18:40 ` David Miller [this message]
2011-04-22 21:31 ` Neil Horman
2011-04-22 21:34 ` David Miller
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=20110422.114033.104072820.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.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).