From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D52F1946C7 for ; Thu, 1 Aug 2024 13:09:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722517769; cv=none; b=IgIwol1jERJ2ZgE79akEVijLVs9JsIKnDg3qE434i56Q9K8D2yM0H7PDkF4jzS35KzHvNrGefVcQGmv8P+I/HU9CeY0DEF8x+TpGIIPyT5XsDjySeBXln929NfIpcuKqPx8FMErKZfRsckUCx8zmsg3ZZmn8hTQADNYo3eg1ZaI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722517769; c=relaxed/simple; bh=9jGa9DtGP8gLr6Tl+ArIizIB4JjfG3FqJ/SS4o7m8b4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g3X0/ZW0DRCc1yhlJqE9rG3cLidqPqQ0Lzb4tMmcs9ddWmxjiPRdArug8HTKT1Rg7VC12gxlOzDKc4CYoeDK/Xd8Ex9tV3EaFEA+vmLqE+5iYtaoZF39liGRSMPrFvdsYpQ1Z1XuKP9a78LO4EzAEMC6Jh5yx/a0/hEu1B/uavM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.client-ip=91.216.245.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1sZVYZ-0000II-HD; Thu, 01 Aug 2024 15:09:23 +0200 Date: Thu, 1 Aug 2024 15:09:23 +0200 From: Florian Westphal To: Christian Hopps Cc: Florian Westphal , devel@linux-ipsec.org, Steffen Klassert , netdev@vger.kernel.org, Christian Hopps Subject: Re: [PATCH ipsec-next v7 07/16] xfrm: iptfs: add new iptfs xfrm mode impl Message-ID: <20240801130923.GA543@breakpoint.cc> References: <20240801080314.169715-1-chopps@chopps.org> <20240801080314.169715-8-chopps@chopps.org> <20240801121310.GA10274@breakpoint.cc> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Christian Hopps wrote: > You are correct the code is not sufficiently protective. > > I need to use rcu to keep `xfrm_mode_cbs_map[mode]` around long enough to do a `try_module_get(&xfrm_mode_cbs_map[mode]->owner)` and return from `xfrm_get_mode_cbs()` with that ref count held. The caller (xfrm_init_state()) will then need do a `module_put()` after it calls `mode_cbs->create_state()` to give the reference back. Yes, that should work.