netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: subashab@codeaurora.org
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com,
	stephen@networkplumber.org, tom@herbertland.com
Subject: Re: [PATCH net-next v3] net: Add sysctl to toggle early demux for tcp and udp
Date: Wed, 22 Mar 2017 14:19:31 -0700 (PDT)	[thread overview]
Message-ID: <20170322.141931.1498296429784499112.davem@davemloft.net> (raw)
In-Reply-To: <1490152810-25133-1-git-send-email-subashab@codeaurora.org>

From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date: Tue, 21 Mar 2017 21:20:10 -0600

> @@ -329,7 +329,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
>  		int protocol = iph->protocol;
>  
>  		ipprot = rcu_dereference(inet_protos[protocol]);
> -		if (ipprot && ipprot->early_demux) {
> +		if (ipprot && READ_ONCE(ipprot->early_demux)) {
>  			ipprot->early_demux(skb);

I think you need to use a local variable for the function pointer in conjunction
with READ_ONCE() for this to work properly:

	if (ipprot && (func = READ_ONCE(ipprot->early_demux))) {
		func(skb);
		...

> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index aacfb4b..30d18cb 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -60,7 +60,7 @@ int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
>  		const struct inet6_protocol *ipprot;
>  
>  		ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]);
> -		if (ipprot && ipprot->early_demux)
> +		if (ipprot && READ_ONCE(ipprot->early_demux))
>  			ipprot->early_demux(skb);
>  	}
>  	if (!skb_valid_dst(skb))

Likewise.

  reply	other threads:[~2017-03-22 21:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22  3:20 [PATCH net-next v3] net: Add sysctl to toggle early demux for tcp and udp Subash Abhinov Kasiviswanathan
2017-03-22 21:19 ` David Miller [this message]
2017-03-23 11:49 ` kbuild test robot
2017-03-23 12:52 ` kbuild test robot

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=20170322.141931.1498296429784499112.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=subashab@codeaurora.org \
    --cc=tom@herbertland.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;
as well as URLs for NNTP newsgroup(s).