Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753971Ab2HKKC5 (ORCPT ); Sat, 11 Aug 2012 06:02:57 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:60682 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588Ab2HKKCy (ORCPT ); Sat, 11 Aug 2012 06:02:54 -0400 From: Denis Efremov To: "David S. Miller" Cc: Denis Efremov , "Michael S. Tsirkin" , Jason Wang , "Eric W. Biederman" , Ian Campbell , 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 Message-Id: <1344679527-13377-1-git-send-email-yefremov.denis@gmail.com> X-Mailer: git-send-email 1.7.7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1081 Lines: 34 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 --- 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 -- 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/