lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1473717691.18970.82.camel@edumazet-glaptop3.roam.corp.google.com>
Date:   Mon, 12 Sep 2016 15:01:31 -0700
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     Jamal Hadi Salim <jhs@...atatu.com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        xiyou.wangcong@...il.com, daniel@...earbox.net,
        john.r.fastabend@...el.com
Subject: Re: [PATCH v4 net-next 1/1] net_sched: Introduce skbmod action

On Mon, 2016-09-12 at 16:46 -0400, Jamal Hadi Salim wrote:

> +
> +static int tcf_skbmod_dump(struct sk_buff *skb, struct tc_action *a,
> +			   int bind, int ref)
> +{
> +	struct tcf_skbmod *d = to_skbmod(a);
> +	unsigned char *b = skb_tail_pointer(skb);
> +	struct tcf_skbmod_params  *p = rtnl_dereference(d->skbmod_p);
> +	struct tc_skbmod opt = {
> +		.index   = d->tcf_index,
> +		.refcnt  = d->tcf_refcnt - ref,
> +		.bindcnt = d->tcf_bindcnt - bind,
> +		.action  = d->tcf_action,
> +	};
> +	struct tcf_t t;
> +
> +	rcu_read_lock();

You do not need rcu read lock protection here, RTNL is enough.

> +
> +	opt.flags  = p->flags;
> +	if (nla_put(skb, TCA_SKBMOD_PARMS, sizeof(opt), &opt))
> +		goto nla_put_failure;
> +	if ((p->flags & SKBMOD_F_DMAC) &&
> +	    nla_put(skb, TCA_SKBMOD_DMAC, ETH_ALEN, p->eth_dst))
> +		goto nla_put_failure;
> +	if ((p->flags & SKBMOD_F_SMAC) &&
> +	    nla_put(skb, TCA_SKBMOD_SMAC, ETH_ALEN, p->eth_src))
> +		goto nla_put_failure;
> +	if ((p->flags & SKBMOD_F_ETYPE) &&
> +	    nla_put_u16(skb, TCA_SKBMOD_ETYPE, ntohs(p->eth_type)))
> +		goto nla_put_failure;
> +
> +	tcf_tm_dump(&t, &d->tcf_tm);
> +	if (nla_put_64bit(skb, TCA_SKBMOD_TM, sizeof(t), &t, TCA_SKBMOD_PAD))
> +		goto nla_put_failure;
> +
> +	rcu_read_unlock();
> +
> +	return skb->len;
> +nla_put_failure:
> +	rcu_read_unlock();
> +	nlmsg_trim(skb, b);
> +	return -1;
> +}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ