netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Efremov <yefremov.denis@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Denis Efremov <yefremov.denis@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@ispras.ru
Subject: [PATCH] macvtap: rcu_dereference outside read-lock section
Date: Sat, 11 Aug 2012 14:05:27 +0400	[thread overview]
Message-ID: <1344679527-13377-1-git-send-email-yefremov.denis@gmail.com> (raw)

In this case it is not an error. rcu_dereference
occurs in update section. Replacement by
rcu_dereference_protected (with spinlock) in order to
prevent lockdep complaint.

Found by Linux Driver Verification project (linuxtesting.org)

Signed-off-by: Denis Efremov <yefremov.denis@gmail.com>
---
 drivers/net/macvtap.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 0737bd4..8ef11a8 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -94,7 +94,8 @@ static int get_slot(struct macvlan_dev *vlan, struct macvtap_queue *q)
 	int i;
 
 	for (i = 0; i < MAX_MACVTAP_QUEUES; i++) {
-		if (rcu_dereference(vlan->taps[i]) == q)
+		if (rcu_dereference_protected(vlan->taps[i],
+				lockdep_is_held(&macvtap_lock)) == q)
 			return i;
 	}
 
-- 
1.7.7

             reply	other threads:[~2012-08-11 10:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-11 10:05 Denis Efremov [this message]
2012-08-12  1:16 ` [PATCH] macvtap: rcu_dereference outside read-lock section David Miller
2012-08-12  6:26   ` [PATCH v2] " Denis Efremov
2012-08-12  8:49     ` Michael S. Tsirkin
2012-08-12 20:41       ` 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=1344679527-13377-1-git-send-email-yefremov.denis@gmail.com \
    --to=yefremov.denis@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=ian.campbell@citrix.com \
    --cc=jasowang@redhat.com \
    --cc=ldv-project@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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).