mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Suzanne Wood <suzannew@cs.pdx.edu>
Cc: linux-kernel@vger.kernel.org, g4klx@g4klx.demon.co.uk,
	hch@infradead.org, jreuter@yaina.de, paulmck@us.ibm.com,
	walpole@cs.pdx.edu
Subject: Re: [RFC][PATCH] rcu in drivers/net/hamradio
Date: Sat, 15 Oct 2005 08:36:13 +1000	[thread overview]
Message-ID: <20051014223613.GA28103@gondor.apana.org.au> (raw)
In-Reply-To: <200510141638.j9EGcsJa000437@rastaban.cs.pdx.edu>

On Fri, Oct 14, 2005 at 09:38:54AM -0700, Suzanne Wood wrote:
> 
> ChangeLog:
> Because bpq_new_device() calls list_add_rcu()
> and bpq_free_device() calls list_del_rcu(),
> substitute list_for_each_entry_rcu() for 
> list_for_each_entry() in bpq_get_ax25_dev().
> This requires the insertion of rcu_read_lock()/unlock().

The rcu_read_lock/unlock is unnecessary because the only caller that
doesn't hold RTNL (bpq_rcv) already takes that lock.  In fact it's
better to take it there since you need to hold the lock for the duration
of the use of the device.

> A consequence of list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list)
> is that the future dereference of the pointer to the bpqdev 
> struct bpq is rcu-protected.  But bpq_get_ax25_dev() 
> returns bpq->axdev, a pointer to a net_device struct.  The 
> rcu_read_lock() in bpq_rcv() likely implies that is another 
> pointer to receive rcu-protected dereference.

The rcu_dereference should be provided by list_for_each_entry_rcu.
In fact there is a bug in the list_*_rcu macros where the first
element is not put through rcu_dereference.  I'll fix that up.

> The rcu_read_lock()/unlock() in bpq_device_event() 
> are removed due to the following found by considering 
> the cases of the switch statement: 

Agreed.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2005-10-14 22:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-14 16:38 Suzanne Wood
2005-10-14 22:36 ` Herbert Xu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-10-16 17:03 Suzanne Wood
2005-10-15 22:24 Suzanne Wood
2005-10-16  7:21 ` Herbert Xu
2005-10-15  7:57 Suzanne Wood
2005-10-15  8:05 ` Herbert Xu
2005-10-14  8:04 Suzanne Wood
2005-10-14 13:37 ` Herbert Xu
2005-10-15 11:24 ` Francois Romieu
2005-10-15 12:03 ` Herbert Xu

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=20051014223613.GA28103@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=g4klx@g4klx.demon.co.uk \
    --cc=hch@infradead.org \
    --cc=jreuter@yaina.de \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®