From: Sabrina Dubroca <sd@queasysnail.net>
To: Florian Westphal <fw@strlen.de>
Cc: netdev@vger.kernel.org, steffen.klassert@secunet.com
Subject: Re: [PATCH ipsec-next 09/11] xfrm: remove afinfo pointer from xfrm_mode
Date: Thu, 28 Mar 2019 15:13:33 +0100 [thread overview]
Message-ID: <20190328141333.GD19967@bistromath.localdomain> (raw)
In-Reply-To: <20190327173140.16891-10-fw@strlen.de>
(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
next prev parent reply other threads:[~2019-03-28 14:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 17:31 [PATCH ipsec-next 00/11] xfrm: remove xfrm_mode indirections Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 01/11] xfrm: place af number into xfrm_mode struct Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 02/11] xfrm: prefer family stored in " Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 03/11] xfrm: remove input indirection from xfrm_mode Florian Westphal
2019-03-28 11:39 ` Sabrina Dubroca
2019-03-28 11:46 ` Florian Westphal
2019-03-29 17:10 ` Eyal Birger
2019-03-29 17:19 ` Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 04/11] xfrm: remove output " Florian Westphal
2019-03-28 11:12 ` Sabrina Dubroca
2019-03-28 11:27 ` Florian Westphal
2019-03-28 11:35 ` Sabrina Dubroca
2019-03-27 17:31 ` [PATCH ipsec-next 05/11] xfrm: remove xmit " Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 06/11] xfrm: remove gso_segment " Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 07/11] xfrm: remove input2 " Florian Westphal
2019-03-27 17:31 ` [PATCH ipsec-next 08/11] xfrm: remove output2 " Florian Westphal
2019-03-28 22:28 ` kbuild test robot
2019-03-29 2:15 ` kbuild test robot
2019-03-27 17:31 ` [PATCH ipsec-next 09/11] xfrm: remove afinfo pointer " Florian Westphal
2019-03-28 14:13 ` Sabrina Dubroca [this message]
2019-03-27 17:31 ` [PATCH ipsec-next 10/11] xfrm: make xfrm modes builtin Florian Westphal
2019-03-29 3:54 ` kbuild test robot
2019-03-27 17:31 ` [PATCH ipsec-next 11/11] xfrm: store xfrm_mode directly, not its address Florian Westphal
2019-03-28 11:42 ` [PATCH ipsec-next 00/11] xfrm: remove xfrm_mode indirections Benedict Wong
2019-03-28 11:48 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190328141333.GD19967@bistromath.localdomain \
--to=sd@queasysnail.net \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox