Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4434536imm; Mon, 14 May 2018 07:31:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpB9/5tJjencogGxcWEnxCS3OF7t1nIX3NM4lQhdNUWIUHOjU6VsFEyWouJXu5IXmrF+X+z X-Received: by 2002:a62:6756:: with SMTP id b83-v6mr10833812pfc.76.1526308318311; Mon, 14 May 2018 07:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526308318; cv=none; d=google.com; s=arc-20160816; b=VWfKGkncioymKb4abXwIJrrFEct3qfT+IjknDHHr8wHDpb+Rt04V/OQLm1VqHoVQaP wu0egJNzkLGML8oCbhdc3ym4W1mnQS1QtMjcJzfOjQAWCQ2StZ4wfyTvVZfUS8MwmUfm 5q39XWyHmNXl89yqMJToPYrQG6wL7uD0TUJy5CBYSkWnbqrnv4RjFW4F/QN4P/OcjhWl Lew7Q8rtuctIY7Yw/klAJ5XdUEJQg4pflM7tCwTcxhTazgCBd4bh47K/XrgFITkTCEVE eSY1nUkbLeasMQgG+Tyh4GFk4q9MqTSWxld5L4tNbPC8yYqMql9j21tfKH0PHfiSRPoe b/WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=clYsggMUMEXFg6roww5W2rXDAlIXhn4b9Q+cIYS4/BA=; b=HUbprZ68vuK/x8rOCDmDByXhw2K0IxyfJmPucOcL/fjARKfgYGPXvNRSHSKTBQHUWq 1UtBE2D+89SRAmFoAKbjjaJrYG1XKwe1lc04cd4DP/osi8CEiuVYvrb1RU7pp26PG76e 8u9JdVKbq9ZEZmxLuG/K58ocvbzbddR02VREPCH3iIol3sWMUOfbBQ4u3iqzFO6NrfDS KEcfe3bU3dkQRc9DKRCM8Er8s1RLidt97se+sokGEiYg/z4VkqJwudlxIIC26p/1bkZQ +3vRpyaoXvOznOEGnW4SDxdJ3amLwuQ+La2aBxL4GUMSTKJ8uoPgTxEWeo/3A11jAJVf uHYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1-v6si2958553pgo.590.2018.05.14.07.31.44; Mon, 14 May 2018 07:31:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932426AbeENO2c (ORCPT + 99 others); Mon, 14 May 2018 10:28:32 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:35240 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753994AbeENO1m (ORCPT ); Mon, 14 May 2018 10:27:42 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vladbu@mellanox.com) with ESMTPS (AES256-SHA encrypted); 14 May 2018 17:29:24 +0300 Received: from reg-r-vrt-018-180.mtr.labs.mlnx (reg-r-vrt-018-180.mtr.labs.mlnx [10.213.18.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w4EERXLf002750; Mon, 14 May 2018 17:27:36 +0300 From: Vlad Buslov To: netdev@vger.kernel.org Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de, ast@kernel.org, daniel@iogearbox.net, edumazet@google.com, vladbu@mellanox.com, keescook@chromium.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, kliteyn@mellanox.com Subject: [PATCH 13/14] net: sched: use unique idr insert function in unlocked actions Date: Mon, 14 May 2018 17:27:14 +0300 Message-Id: <1526308035-12484-14-git-send-email-vladbu@mellanox.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1526308035-12484-1-git-send-email-vladbu@mellanox.com> References: <1526308035-12484-1-git-send-email-vladbu@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Substitute calls to action insert function with calls to action insert unique function that warns if insertion overwrites index in idr. Signed-off-by: Vlad Buslov --- net/sched/act_bpf.c | 2 +- net/sched/act_connmark.c | 2 +- net/sched/act_csum.c | 2 +- net/sched/act_gact.c | 2 +- net/sched/act_ife.c | 2 +- net/sched/act_ipt.c | 2 +- net/sched/act_mirred.c | 2 +- net/sched/act_nat.c | 2 +- net/sched/act_pedit.c | 2 +- net/sched/act_police.c | 2 +- net/sched/act_sample.c | 2 +- net/sched/act_simple.c | 2 +- net/sched/act_skbedit.c | 2 +- net/sched/act_skbmod.c | 2 +- net/sched/act_tunnel_key.c | 2 +- net/sched/act_vlan.c | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index 7e20fdc..0bf4ecf 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -354,7 +354,7 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla, rcu_assign_pointer(prog->filter, cfg.filter); if (res == ACT_P_CREATED) { - tcf_idr_insert(tn, *act); + tcf_idr_insert_unique(tn, *act); } else { /* make sure the program being replaced is no longer executing */ synchronize_rcu(); diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 6ff45af..a4e9f21 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c @@ -135,7 +135,7 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla, ci->net = net; ci->zone = parm->zone; - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); ret = ACT_P_CREATED; } else { ci = to_connmark(*a); diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 49d06c3..d9836d2 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c @@ -105,7 +105,7 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla, kfree_rcu(params_old, rcu); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 2edefeb..79266590 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -128,7 +128,7 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla, } #endif if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 665790f..060144e 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -590,7 +590,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, kfree_rcu(p_old, rcu); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 946193e..ff8cf9d 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -188,7 +188,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, ipt->tcfi_hook = hook; spin_unlock_bh(&ipt->tcf_lock); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; err3: diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 4c8bd26..7ab8d0c 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -157,7 +157,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, if (ret == ACT_P_CREATED) { list_add(&m->tcfm_list, &mirred_list); - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); } return ret; diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index a1a1885..a15c4a9 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c @@ -89,7 +89,7 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est, spin_unlock_bh(&p->tcf_lock); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index e5e93e2..49034d4 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -220,7 +220,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, spin_unlock_bh(&p->tcf_lock); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_police.c b/net/sched/act_police.c index ced6b1f..eb4e458 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -194,7 +194,7 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, return ret; police->tcfp_t_c = ktime_get_ns(); - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 7411805..5a650d4 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -97,7 +97,7 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla, } if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index a4b2aca..13809e5 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -146,7 +146,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla, } if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 7750b77..bf87679 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -169,7 +169,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, spin_unlock_bh(&d->tcf_lock); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index bbc5092..dc36e6f 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -185,7 +185,7 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, kfree_rcu(p_old, rcu); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 4367962..16926c7 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -198,7 +198,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, kfree_rcu(params_old, rcu); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index adc4e6e..02fbf76 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -221,7 +221,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, kfree_rcu(p_old, rcu); if (ret == ACT_P_CREATED) - tcf_idr_insert(tn, *a); + tcf_idr_insert_unique(tn, *a); return ret; } -- 2.7.5