From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steffen Klassert Subject: Re: [RFC ipsec-next] xfrm: Remove xfrmi interface ID from flowi Date: Thu, 19 Jul 2018 09:45:20 +0200 Message-ID: <20180719074520.i4wnyas7nipyteyc@gauss3.secunet.de> References: <20180717214004.102501-1-benedictwong@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: , , To: Benedict Wong Return-path: Received: from a.mx.secunet.com ([62.96.220.36]:42170 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731288AbeGSI1M (ORCPT ); Thu, 19 Jul 2018 04:27:12 -0400 Content-Disposition: inline In-Reply-To: <20180717214004.102501-1-benedictwong@google.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Jul 17, 2018 at 02:40:04PM -0700, Benedict Wong wrote: > @@ -2301,6 +2322,13 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, > int reverse; > struct flowi fl; > int xerr_idx = -1; > + const struct xfrm_if_cb *ifcb; > + struct xfrm_if *xi; > + u32 if_id = 0; > + > + rcu_read_lock(); > + ifcb = xfrm_if_get_cb(); > + rcu_read_unlock(); > > reverse = dir & ~XFRM_POLICY_MASK; > dir &= XFRM_POLICY_MASK; > @@ -2325,10 +2353,16 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, > } > } > > + if (ifcb) { > + xi = ifcb->decode_session(skb); > + if (xi) > + if_id = xi->p.if_id; > + } The usage of the ifcb pointer should go into the rcu_read_lock section above. Looks good otherwise, nice improvement. Please respin and do an official submission of this patch, I'd like to merge it before I send the pull request for the ipsec-next tree.