The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Steven Whitehouse <steve@chygwyn.com>
To: "Paul E. McKenney" <paulmck@us.ibm.com>,
	Suzanne Wood <suzannew@cs.pdx.edu>
Cc: linux-kernel@vger.kernel.org, steve@chygwyn.com,
	walpole@cs.pdx.edu, patrick@tykepenguin.com
Subject: Re: rcu read-side protection
Date: Wed, 17 Aug 2005 09:25:52 +0100	[thread overview]
Message-ID: <20050817082552.GA25537@souterrain.chygwyn.com> (raw)
In-Reply-To: <20050817020156.GF1319@us.ibm.com>

Hi,

On Tue, Aug 16, 2005 at 07:01:57PM -0700, Paul E. McKenney wrote:
> On Tue, Aug 16, 2005 at 05:09:29PM -0700, Suzanne Wood wrote:
> [ . . . ]
> > A read-side critical section is marked to protect the dereference of the 
> > dn_ptr and assignment to dn_db which is a pointer to a dn_dev.  (struct 
> > net_device is defined in /linux/netdevice.h and its dn_ptr in 
> > /include/net/dn_dev.h)  Should this rcu-protection be extended to the line 
> > following rcu_read_lock()?  Even though use_long is a simple char, it 
> > appears to be a member of an rcu-protected structure.
> 
> Looks to me that this could indeed be a problem -- the structure
> pointed to by dn_db could potentially be freed immediately after the
> rcu_read_unlock(), unless there is some other non-obvious locking
> mechanism protecting it.  In which case, why the rcu_read_lock()
> and rcu_read_unlock()...
> 
> 						Thanx, Paul

The dev->dn_ptr points to the DECnet specific portion of a net device which
is allocated in dn_dev.c/dn_dev_up and freed in dn_dev.c/dn_dev_delete when
the net device goes up and down.

So I think you are right in that as far as I can see, its possible for a
net device going down to race with this, but the window of opportunity is
very small indeed (in fact possibly zero?) due to the ordering of operations
in dn_dev_delete where dev->dn_ptr is set to NULL (esentially preventing
any more DECnet packets being received on that device) before flushing all
neighbours and only then releasing dn_db.

Also, Patrick Caulfield is maintaining this code now, so I've added him to
the CC list. Thanks for the report though,

Steve.


  reply	other threads:[~2005-08-17  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-17  0:09 rcu read-side protection Suzanne Wood
2005-08-17  2:01 ` Paul E. McKenney
2005-08-17  8:25   ` Steven Whitehouse [this message]
2005-08-17 14:14     ` Paul E. McKenney
2005-08-17 14:45       ` Steven Whitehouse
2005-08-17 15:21       ` Patrick Caulfield
2005-08-17 19:05       ` David S. 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=20050817082552.GA25537@souterrain.chygwyn.com \
    --to=steve@chygwyn.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrick@tykepenguin.com \
    --cc=paulmck@us.ibm.com \
    --cc=suzannew@cs.pdx.edu \
    --cc=walpole@cs.pdx.edu \
    /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