netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@redhat.com>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: David Miller <davem@davemloft.net>,
	David.Laight@ACULAB.COM, vfalico@redhat.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] netconsole: fix NULL pointer dereference
Date: Fri, 25 Oct 2013 16:15:01 +0200	[thread overview]
Message-ID: <526A7CE5.8040205@redhat.com> (raw)
In-Reply-To: <20131024205934.GA26855@electric-eye.fr.zoreil.com>

On 10/24/2013 10:59 PM, Francois Romieu wrote:
> Nikolay Aleksandrov <nikolay@redhat.com> :
>> On 10/24/2013 07:56 PM, David Miller wrote:
>>> From: "David Laight" <David.Laight@ACULAB.COM>
> [...]
>>>> Ditto - might be worth saying:
>>>>     /* Acquire lock to wait for any write_msg() to complete. */
>>>
>>> Something this subtle definitely requires a comment.
>>>
>> Okay, thank you all for the reviews. I will re-submit a v2 with
>> the comment edited.
> 
> "edited" as in "removed" because:
> 1. an irq disabling spinlock loudly states what the intent is ("hey, this
>    netconsole stuff could be concurrently used in irq or softirq context").
> 2. the target_list_lock spinlock itself tells where to look for:
> 
> drivers/net/netconsole.c
> [...]
> /* This needs to be a spinlock because write_msg() cannot sleep */
> static DEFINE_SPINLOCK(target_list_lock);
> 
I thought so too. Although I also mentioned the problem and that it involves
write_msg in the current comment:
+		/* We need to disable the netconsole before cleaning it up
+		 * otherwise we might end up in write_msg() with
+		 * nt->np.dev == NULL and nt->enabled == 1
+		 */

I thought this implies that the spinlock protects us against running with
write_msg().
It's fine by me either way (with or w/o the addition to the comment). It's up to
you Dave, do you still want it explicitly there ?

  reply	other threads:[~2013-10-25 14:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 13:04 [PATCH net] netconsole: fix NULL pointer dereference Nikolay Aleksandrov
2013-10-24 10:21 ` Veaceslav Falico
2013-10-24 10:39   ` David Laight
2013-10-24 17:56     ` David Miller
2013-10-24 18:22       ` Nikolay Aleksandrov
2013-10-24 20:59         ` Francois Romieu
2013-10-25 14:15           ` Nikolay Aleksandrov [this message]
2013-10-25 23:06             ` Francois Romieu

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=526A7CE5.8040205@redhat.com \
    --to=nikolay@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    --cc=vfalico@redhat.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).