All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: gfree.wind@vip.163.com
Cc: dsa@cumulusnetworks.com, shm@cumulusnetworks.com,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net] driver: vrf: Fix one possible use-after-free issue
Date: Tue, 9 May 2017 11:21:02 +0200	[thread overview]
Message-ID: <20170509092102.GB16263@breakpoint.cc> (raw)
In-Reply-To: <1494320069-39638-1-git-send-email-gfree.wind@vip.163.com>

gfree.wind@vip.163.com <gfree.wind@vip.163.com> wrote:
> When one netfilter rule or hook stoles the skb and return NF_STOLEN,
> it means the skb is taken by the rule, and other modules should not
> touch this skb ever. Maybe the skb is queued or freed directly by the
> rule.
> 
> Now uses the nf_hook instead of NF_HOOK to get the result of netfilter,
> and check the return value of nf_hook. Only when its value equals 1, it
> means the skb could go ahead. Or reset the skb as NULL.
> 
> BTW, because vrf_rcv_finish is empty function, so needn't invoke it
> even though nf_hook returns 1.

Thats a bug then.

The okfn (if called) takes ownership of skb and must free it eventually.
Otherwise userspace queueing leaks skb on reinjection.

(see nf_reinject() and its use of okfn()).

  reply	other threads:[~2017-05-09  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09  8:54 [PATCH net] driver: vrf: Fix one possible use-after-free issue gfree.wind
2017-05-09  9:21 ` Florian Westphal [this message]
2017-05-09  9:41   ` Gao Feng

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=20170509092102.GB16263@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=gfree.wind@vip.163.com \
    --cc=netdev@vger.kernel.org \
    --cc=shm@cumulusnetworks.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.