From patchwork Thu Sep 9 15:33: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: 64309 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 5D537B70D1 for ; Fri, 10 Sep 2010 01:33:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753568Ab0IIPdu (ORCPT ); Thu, 9 Sep 2010 11:33:50 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:52279 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753170Ab0IIPdt (ORCPT ); Thu, 9 Sep 2010 11:33:49 -0400 Received: by fxm16 with SMTP id 16so964398fxm.19 for ; Thu, 09 Sep 2010 08:33: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=x+2wN4wZtvx8IEBUaMBNOdKH09WLBJloa8nAqTVHz70=; b=xBfxIfDBx3ZS2eEEom2NEl2rnD8UUKJJVM866KWBDSYk8s2hMnaOCWc9oKYT4timNF pzY4CI6aM6gX6tW0L5E3A9qelsl7JrD0cKJ3t118N2i2iHmbWaT+bzQG+lJsL8CKVI6z 4jEKsp7cng1bOtLdPXVos0TQCA7S0dq6OEn/I= 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=BOC2XWFBPtDa7NndpUlTyYehyRolXCR5fHyVc83OTySYTVdOLpuooBNkzOgD4qPv3u p72HCMu8looTlWG2f4c+HD4+gLwUeVRmS18CecTnQa+jj6lMCkxCIF+31O0Cwg4JIq6h wdYhiDCZEzlDyWTgCMtGbs6EQhMCHkzFXrrp4= Received: by 10.223.115.19 with SMTP id g19mr41237faq.70.1284046427193; Thu, 09 Sep 2010 08:33:47 -0700 (PDT) Received: from [10.150.51.210] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id 14sm751554fav.26.2010.09.09.08.33.45 (version=SSLv3 cipher=RC4-MD5); Thu, 09 Sep 2010 08:33:46 -0700 (PDT) Subject: [PATCH net-next-2.6] tunnels: missing rcu_assign_pointer() From: Eric Dumazet To: David Miller Cc: netdev Date: Thu, 09 Sep 2010 17:33:43 +0200 Message-ID: <1284046423.2589.188.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 xfrm4_tunnel_register() & xfrm6_tunnel_register() should use rcu_assign_pointer() to make sure previous writes (to handler->next) are committed to memory before chain insertion. deregister functions dont need a particular barrier. Signed-off-by: Eric Dumazet --- No risk of crash, because handler->next is NULL before register() call, but a possibility of packet being dropped. net/ipv4/tunnel4.c | 2 +- net/ipv6/tunnel6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 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/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c index df59d16..9a17bd2 100644 --- a/net/ipv4/tunnel4.c +++ b/net/ipv4/tunnel4.c @@ -39,7 +39,7 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) } handler->next = *pprev; - *pprev = handler; + rcu_assign_pointer(*pprev, handler); ret = 0; diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c index 3177fe0..d986472 100644 --- a/net/ipv6/tunnel6.c +++ b/net/ipv6/tunnel6.c @@ -51,7 +51,7 @@ int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family) } handler->next = *pprev; - *pprev = handler; + rcu_assign_pointer(*pprev, handler); ret = 0;