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=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 2774AC43381 for ; Thu, 28 Mar 2019 14:13:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01DB021773 for ; Thu, 28 Mar 2019 14:13:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbfC1ONo (ORCPT ); Thu, 28 Mar 2019 10:13:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59186 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbfC1ONo (ORCPT ); Thu, 28 Mar 2019 10:13:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1ABA43006384; Thu, 28 Mar 2019 14:13:39 +0000 (UTC) Received: from bistromath.localdomain (unknown [10.40.205.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FF6B1001944; Thu, 28 Mar 2019 14:13:34 +0000 (UTC) Date: Thu, 28 Mar 2019 15:13:33 +0100 From: Sabrina Dubroca To: Florian Westphal Cc: netdev@vger.kernel.org, steffen.klassert@secunet.com Subject: Re: [PATCH ipsec-next 09/11] xfrm: remove afinfo pointer from xfrm_mode Message-ID: <20190328141333.GD19967@bistromath.localdomain> References: <20190327173140.16891-1-fw@strlen.de> <20190327173140.16891-10-fw@strlen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190327173140.16891-10-fw@strlen.de> User-Agent: Mutt/1.11.4 (2019-03-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 28 Mar 2019 14:13:44 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org (just a couple of checkpatch-like comments) 2019-03-27, 18:31:38 +0100, Florian Westphal wrote: > diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c > index 6802d1aee424..cff048ad8562 100644 > --- a/net/ipv4/xfrm4_output.c > +++ b/net/ipv4/xfrm4_output.c > @@ -72,6 +72,8 @@ int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb) > static int __xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb) > { > struct xfrm_state *x = skb_dst(skb)->xfrm; > + const struct xfrm_state_afinfo *afinfo; > + int ret = -EAFNOSUPPORT; > > #ifdef CONFIG_NETFILTER > if (!x) { > @@ -80,7 +82,14 @@ static int __xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb) > } > #endif > > - return x->outer_mode->afinfo->output_finish(sk, skb); > + rcu_read_lock(); > + afinfo = xfrm_state_afinfo_get_rcu(x->outer_mode->family); > + if (afinfo) > + ret = afinfo->output_finish(sk, skb); > + else > + kfree_skb(skb); > + rcu_read_unlock(); Maybe add a blank line before the return, like you did in __xfrm6_output_state_finish(). > + return ret; > } > > int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb) > diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c > index 2b663d2ffdcd..82168de60e6b 100644 > --- a/net/ipv6/xfrm6_output.c > +++ b/net/ipv6/xfrm6_output.c > @@ -122,11 +122,27 @@ int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb) > return xfrm_output(sk, skb); > } > > +static int __xfrm6_output_state_finish(struct xfrm_state *x, struct sock *sk, struct sk_buff *skb) Over 80 chars. > +{ > + const struct xfrm_state_afinfo *afinfo; > + int ret = -EAFNOSUPPORT; > + > + rcu_read_lock(); > + afinfo = xfrm_state_afinfo_get_rcu(x->outer_mode->family); > + if (afinfo) > + ret = afinfo->output_finish(sk, skb); > + else > + kfree_skb(skb); > + rcu_read_unlock(); > + > + return ret; > +} > + > static int __xfrm6_output_finish(struct net *net, struct sock *sk, struct sk_buff *skb) > { > struct xfrm_state *x = skb_dst(skb)->xfrm; > > - return x->outer_mode->afinfo->output_finish(sk, skb); > + return __xfrm6_output_state_finish(x, sk, skb); > } > > static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) > @@ -168,7 +184,8 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) > __xfrm6_output_finish); > > skip_frag: > - return x->outer_mode->afinfo->output_finish(sk, skb); > + You could skip the extra blank line. > + return __xfrm6_output_state_finish(x, sk, skb); > } > > int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) -- Sabrina