From patchwork Tue Apr 27 06:40:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 51033 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6702FB7D53 for ; Tue, 27 Apr 2010 16:40:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751306Ab0D0Gkt (ORCPT ); Tue, 27 Apr 2010 02:40:49 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:48625 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830Ab0D0Gkt (ORCPT ); Tue, 27 Apr 2010 02:40:49 -0400 Received: by bwz19 with SMTP id 19so158535bwz.21 for ; Mon, 26 Apr 2010 23:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=K1MSzWC2f4svS6uVjdH7AYdm5o6J2sFUp8ByK9jTCYM=; b=Fr9CFvdd7zxbQ192jfzQtUwHhqlVm8lvUJUkBCHAGn0pIcTuC+ycOcGaRqt4JXQZZI JdS+VqCZsg1Ouw8n3AIjZz5yugx1eRSaIGwFRpsWbnPLQUWLcQ9zMIPQ9O3eoZC2T7Tc ssUxeZ76pbgOCs9bIEjgkhcVFqJrPUAXrkp50= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=i8bEen9HeaqBDyTlCa+6Pubexragt4xcnC8GWh/VmAiRLEkaVrxIiuhwm2PS7DeZ6B u9YifiKjFztI6NTpaxmVNB+ndZ8JVuQarSPpg/a6UjMu1jffHTNVW8MgSKv6X8TcTsfb dA8xktiBKCe6VI0DcfOWFx9oWmtRGnrM5qmVw= Received: by 10.204.35.139 with SMTP id p11mr3289009bkd.178.1272350447089; Mon, 26 Apr 2010 23:40:47 -0700 (PDT) Received: from [127.0.0.1] (gw1.cosmosbay.com [212.99.114.194]) by mx.google.com with ESMTPS id 14sm1756965bwz.14.2010.04.26.23.40.45 (version=SSLv3 cipher=RC4-MD5); Mon, 26 Apr 2010 23:40:46 -0700 (PDT) Subject: [PATCH net-next-2.6] net: fix a lockdep rcu warning in __sk_dst_set() From: Eric Dumazet To: David Miller Cc: netdev Date: Tue, 27 Apr 2010 08:40:43 +0200 Message-ID: <1272350443.4861.9.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org __sk_dst_set() might be called while no state can be integrated in a rcu_dereference_check() condition. So use rcu_dereference_raw() to shutup lockdep warnings (if CONFIG_PROVE_RCU is set) Signed-off-by: Eric Dumazet Acked-by: Paul E. McKenney --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/net/sock.h b/include/net/sock.h index 86a8ca1..94dbdbc 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1236,8 +1236,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst) struct dst_entry *old_dst; sk_tx_queue_clear(sk); - old_dst = rcu_dereference_check(sk->sk_dst_cache, - lockdep_is_held(&sk->sk_dst_lock)); + /* + * This can be called while sk is owned by the caller only, + * with no state that can be checked in a rcu_dereference_check() cond + */ + old_dst = rcu_dereference_raw(sk->sk_dst_cache); rcu_assign_pointer(sk->sk_dst_cache, dst); dst_release(old_dst); }