Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3584330imc; Thu, 14 Mar 2019 00:00:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNiv3u2Z0+QSUlnJ34+TjBjbUIjHgcZpYE7A03FN4HEYBV6R4h+keQxVv013hMOLw+O0JE X-Received: by 2002:a63:f407:: with SMTP id g7mr43612812pgi.413.1552546845573; Thu, 14 Mar 2019 00:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552546845; cv=none; d=google.com; s=arc-20160816; b=pDkTyAuARnAqIcB8U4E7GKwRV66qigwz1F5rIgsftg+rrT7qjCp2QagLG3xAT7uLtC gXouxfcdl9CGfEubV9sHRkj1SKgdrn/YP9ag5cNxv4v02cjOLKfhTYleJvSolaVpiluJ zVbddEEN5nxm5+eteprm8dwbf8wX7FEmnl3jw5gEZKAiVPj2FMt5HtCCYMDYPwAOXrjX rdAGnGoHRD/HjkzQlHrV2D/y81qNx8v8XGL4ZXp2b+Upprql58r8qHv8q6H0/IH1eFl1 BmVqkZJx5Y7Rzc9EX9A01GDslDFaGBX270bAbWH1kv+tnQeWC9pS6wXWvl5I5CQl9laV yPCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=/mBEsIfLjrtJXNpu4al3MQGPdtrvhp+sCsIOwhBcTls=; b=JwK18hhX8PmkGoDW9d4dcnDlw9SNM81nM+ihqjzk8od8Ba7KkPWEUbyogwEd9lQhA3 AVzADJq284ACWX60nOREvNkcIPW8BV6xCDqU1CvXsghcb/nO7+lH8VmAwi/3dmf3LvRb v4a/QPuhSp8TiVhGb7BnJ8wXV6USQhG1okwFkzSgLhUrX2bxlUXMpQcKqn1zifnae+Wu mvY7xVWGFXORQaKf1AzZQUzdY6wR+B3zeown/plnMG+yP0bXqGxrj6SfFIG3hM/4G42s Eg3wwXylDwGakYBjG+gR+Y0cewT0UBhqh0t/xiFLHDh3FLX85urioMCRG7l9NGdtZOP9 8D3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si11260662pgt.415.2019.03.14.00.00.29; Thu, 14 Mar 2019 00:00:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbfCNG7w (ORCPT + 99 others); Thu, 14 Mar 2019 02:59:52 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:57139 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726464AbfCNG7w (ORCPT ); Thu, 14 Mar 2019 02:59:52 -0400 X-IronPort-AV: E=Sophos;i="5.58,477,1544457600"; d="scan'208";a="56744257" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 14 Mar 2019 14:59:49 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id A764E4C8B058; Thu, 14 Mar 2019 14:59:27 +0800 (CST) Received: from localhost.localdomain (10.167.226.33) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Mar 2019 14:59:50 +0800 From: Su Yanjun To: , , , , CC: , , Subject: [PATCH] xfrm6_tunnel: Fix potential panic when unloading xfrm6_tunnel module Date: Thu, 14 Mar 2019 14:59:42 +0800 Message-ID: <1552546782-102587-1-git-send-email-suyj.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.33] X-yoursite-MailScanner-ID: A764E4C8B058.A0B7C X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suyj.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When unloading xfrm6_tunnel module, xfrm6_tunnel_fini directly frees the xfrm6_tunnel_spi_kmem. Maybe someone has gotten the xfrm6_tunnel_spi, so need to wait it. Fixes: 91cc3bb0b04ff("xfrm6_tunnel: RCU conversion") Signed-off-by: Su Yanjun --- net/ipv6/xfrm6_tunnel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index bc65db7..12cb3aa 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -402,6 +402,10 @@ static void __exit xfrm6_tunnel_fini(void) xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); unregister_pernet_subsys(&xfrm6_tunnel_net_ops); + /* Someone maybe has gotten the xfrm6_tunnel_spi. + * So need to wait it. + */ + rcu_barrier(); kmem_cache_destroy(xfrm6_tunnel_spi_kmem); } -- 2.7.4