From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCH net-next 12/14] net: sched: act_mirred: remove dependency on rtnl lock Date: Tue, 7 Aug 2018 18:36:30 +0200 Message-ID: <20180807163630.GD2890@nanopsycho> References: <1533538465-23199-1-git-send-email-vladbu@mellanox.com> <1533538465-23199-13-git-send-email-vladbu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de, ast@kernel.org, daniel@iogearbox.net, edumazet@google.com, keescook@chromium.org, marcelo.leitner@gmail.com To: Vlad Buslov Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:52602 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730869AbeHGSye (ORCPT ); Tue, 7 Aug 2018 14:54:34 -0400 Received: by mail-wm0-f65.google.com with SMTP id o11-v6so17973502wmh.2 for ; Tue, 07 Aug 2018 09:39:26 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1533538465-23199-13-git-send-email-vladbu@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: Mon, Aug 06, 2018 at 08:54:23AM CEST, vladbu@mellanox.com wrote: [...] >diff --git a/include/net/tc_act/tc_tunnel_key.h b/include/net/tc_act/tc_tunnel_key.h >index 46b8c7f1c8d5..e6e475d788c6 100644 >--- a/include/net/tc_act/tc_tunnel_key.h >+++ b/include/net/tc_act/tc_tunnel_key.h >@@ -30,26 +30,47 @@ struct tcf_tunnel_key { > > static inline bool is_tcf_tunnel_set(const struct tc_action *a) > { >+ bool ret = false; > #ifdef CONFIG_NET_CLS_ACT > struct tcf_tunnel_key *t = to_tunnel_key(a); >- struct tcf_tunnel_key_params *params = rtnl_dereference(t->params); >+ struct tcf_tunnel_key_params *params; > >+ rcu_read_lock(); >+ params = rcu_dereference(t->params); > if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY) >- return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET; >+ ret = params->tcft_action == TCA_TUNNEL_KEY_ACT_SET; >+ rcu_read_unlock(); > #endif >- return false; >+ return ret; > } > > static inline bool is_tcf_tunnel_release(const struct tc_action *a) Why are these tunnel things in a mirred patch? [...] > static struct net_device *tcf_mirred_get_dev(const struct tc_action *a) > { > struct tcf_mirred *m = to_mirred(a); >+ struct net_device *dev; >+ >+ rcu_read_lock(); >+ dev = rcu_dereference(m->tcfm_dev); >+ if (dev) >+ dev_hold(dev); >+ rcu_read_unlock(); > >- return rtnl_dereference(m->tcfm_dev); >+ return dev; > } > > static int tcf_mirred_delete(struct net *net, u32 index) >diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c >index e8b0bbd0883f..0cce0eadc28b 100644 >--- a/net/sched/cls_api.c >+++ b/net/sched/cls_api.c >@@ -2167,6 +2167,7 @@ static int tc_exts_setup_cb_egdev_call(struct tcf_exts *exts, > if (!dev) > continue; > ret = tc_setup_cb_egdev_call(dev, type, type_data, err_stop); >+ dev_put(dev); This looks really odd. a->ops->put_dev is needed. > if (ret < 0) > return ret; > ok_count += ret; >-- >2.7.5 >