From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 196EDC04AAF for ; Thu, 16 May 2019 11:43:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D63F520833 for ; Thu, 16 May 2019 11:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558007032; bh=Lbbshxy3t043RQwkX65Q3YiIe574q3DmADiisCqRfFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pulARUsrFuG73/e/eaDGW60aA4k8B5QmJ7R6Vwy/2YE89t84qoyLd40VIQ0S3Gz6A Vq4/DKdMaFmodfaTzQrEI2MsB+GlV+6w6p4ia4IzMCWP3PpaqO7nOwQKqtwwKEAVWF COJqg/+9nHFWqLnovPNxwsoFiripcp7Ud5UFVInE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728258AbfEPLli (ORCPT ); Thu, 16 May 2019 07:41:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:50372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728234AbfEPLlh (ORCPT ); Thu, 16 May 2019 07:41:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7322220833; Thu, 16 May 2019 11:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558006897; bh=Lbbshxy3t043RQwkX65Q3YiIe574q3DmADiisCqRfFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CrVqBawffrjnnfeIGRGdKIQXD9TnXK4E8NNUjE9iCOd4XgMwK76uRON1sPkYv+ADW 8AWtxSGnZHevJOyokV/6778hrjoRalH6t3If5t5ijBxABMvuxT4KDcg3aGnNWYuMBo MbgfhWKv6jKXnbnL/sh6uxN87n/xuU5TegMRk224= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Su Yanjun , Herbert Xu , Steffen Klassert , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 2/9] xfrm6_tunnel: Fix potential panic when unloading xfrm6_tunnel module Date: Thu, 16 May 2019 07:41:26 -0400 Message-Id: <20190516114134.9146-2-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190516114134.9146-1-sashal@kernel.org> References: <20190516114134.9146-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Su Yanjun [ Upstream commit 6ee02a54ef990a71bf542b6f0a4e3321de9d9c66 ] 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 Acked-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- 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 3a2701d42f471..07b7b2540579c 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -391,6 +391,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.20.1