Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751507Ab2HLIsj (ORCPT ); Sun, 12 Aug 2012 04:48:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6289 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750982Ab2HLIsf (ORCPT ); Sun, 12 Aug 2012 04:48:35 -0400 Date: Sun, 12 Aug 2012 11:49:29 +0300 From: "Michael S. Tsirkin" To: Denis Efremov Cc: "David S. Miller" , Jason Wang , "Eric W. Biederman" , Ian Campbell , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@ispras.ru Subject: Re: [PATCH v2] macvtap: rcu_dereference outside read-lock section Message-ID: <20120812084929.GB4430@redhat.com> References: <20120811.181642.1587792778007257202.davem@davemloft.net> <1344752791-21140-1-git-send-email-yefremov.denis@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1344752791-21140-1-git-send-email-yefremov.denis@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1427 Lines: 49 On Sun, Aug 12, 2012 at 10:26:31AM +0400, Denis Efremov wrote: > rcu_dereference occurs in update section. Replacement by > rcu_dereference_protected in order to prevent lockdep > complaint. > > Found by Linux Driver Verification project (linuxtesting.org) > > Signed-off-by: Denis Efremov > --- > 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..0f0f9ce 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) And now it's too long. Maybe a temporary would be better? struct macvtap_queue *t; t = rcu_dereference_protected(vlan->taps[i], lockdep_is_held(&macvtap_lock)); if (t == q) return i; ? Anyway - Acked-by: Michael S. Tsirkin > return i; > } > > -- > 1.7.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/