[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1473344352.15733.46.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Thu, 08 Sep 2016 07:19:12 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Hadar Hen Zion <hadarh@...lanox.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Jiri Pirko <jiri@...lanox.com>, Jiri Benc <jbenc@...hat.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Shmulik Ladkani <shmulik.ladkani@...il.com>,
Tom Herbert <tom@...bertland.com>,
Eric Dumazet <edumazet@...gle.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Amir Vadai <amirva@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>, Amir Vadai <amir@...ai.me>
Subject: Re: [PATCH net-next V7 4/4] net/sched: Introduce act_tunnel_key
On Thu, 2016-09-08 at 16:23 +0300, Hadar Hen Zion wrote:
> From: Amir Vadai <amir@...ai.me>
>
> This action could be used before redirecting packets to a shared tunnel
> device, or when redirecting packets arriving from a such a device.
> +static void tunnel_key_release(struct tc_action *a, int bind)
> +{
> + struct tcf_tunnel_key *t = to_tunnel_key(a);
> + struct tcf_tunnel_key_params *params;
> +
> + rcu_read_lock();
> + params = rcu_dereference(t->params);
> +
> + if (params->tcft_action == TCA_TUNNEL_KEY_ACT_SET)
> + dst_release(¶ms->tcft_enc_metadata->dst);
> +
> + kfree_rcu(params, rcu);
> +
> + rcu_read_unlock();
> +}
Note that you own the action here, so technically speaking no writer
could possibly modify t->params while this function is running.
So you could use
params = rcu_dereference_protected(t->params, 1)
(I could not find a way to express the 'I own this action and am the
last user' for LOCKDEP sake so I used 1)
instead of
rcu_read_lock();
params = rcu_dereference(t->params);
rcu_read_unlock();
But this is a very minor detail, and this patch looks fine to me, thanks
a lot for your patience Hadar .
Acked-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists