netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eyal.birger@gmail.com
Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com,
	netdev@vger.kernel.org, pablo@netfilter.org,
	shmulik@metanetworks.com, eyal@metanetworks.com
Subject: Re: [PATCH net-next 2/2] net: sched: add em_ipt ematch for calling xtables matches
Date: Wed, 24 Jan 2018 16:37:16 -0500 (EST)	[thread overview]
Message-ID: <20180124.163716.301711852222011274.davem@davemloft.net> (raw)
In-Reply-To: <1516699052-19259-3-git-send-email-eyal.birger@gmail.com>

From: Eyal Birger <eyal.birger@gmail.com>
Date: Tue, 23 Jan 2018 11:17:32 +0200

> +	network_offset = skb_network_offset(skb);
> +	skb_pull(skb, network_offset);
> +
> +	rcu_read_lock();
> +
> +	if (skb->skb_iif)
> +		indev = dev_get_by_index_rcu(em->net, skb->skb_iif);
> +
> +	nf_hook_state_init(&state, im->hook, im->nfproto, indev ?: skb->dev,
> +			   skb->dev, NULL, em->net, NULL);
> +
> +	acpar.match = im->match;
> +	acpar.matchinfo = im->match_data;
> +	acpar.state = &state;
> +
> +	ret = im->match->match(skb, &acpar);
> +
> +	rcu_read_unlock();
> +
> +	skb_push(skb, network_offset);

If the SKB is shared in any way, this pull/push around the NF hook
invocation is illegal.

  parent reply	other threads:[~2018-01-24 21:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23  9:17 [PATCH net-next 0/2] net: sched: introduce em_ipt ematch Eyal Birger
2018-01-23  9:17 ` [PATCH net-next 1/2] net: sched: ematch: pass protocol to ematch 'change()' handlers Eyal Birger
2018-01-23  9:17 ` [PATCH net-next 2/2] net: sched: add em_ipt ematch for calling xtables matches Eyal Birger
2018-01-23 12:15   ` Pablo Neira Ayuso
2018-01-24 21:37   ` David Miller [this message]
2018-01-25  0:00     ` Pablo Neira Ayuso
2018-01-26  4:24       ` Eyal Birger

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=20180124.163716.301711852222011274.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eyal.birger@gmail.com \
    --cc=eyal@metanetworks.com \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=shmulik@metanetworks.com \
    --cc=xiyou.wangcong@gmail.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).