All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yanjun <zyjzyj2000@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: "Zhu Yanjun" <yanjun.zhu@intel.com>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Karlsson, Magnus" <magnus.karlsson@intel.com>,
	netdev <netdev@vger.kernel.org>,
	jonathan.lemon@gmail.com
Subject: Re: [PATCH v2 1/1] xdp: avoid calling kfree twice
Date: Wed, 9 Dec 2020 12:30:55 +0800	[thread overview]
Message-ID: <CAD=hENc8CmxdPeWbQ=4GFdtQCoCqUc87xS5sq+VePZEGC2-Z6g@mail.gmail.com> (raw)
In-Reply-To: <f68c2d75-4a51-445d-cecf-894b65cb8d55@iogearbox.net>

On Wed, Dec 9, 2020 at 1:12 AM Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 12/9/20 6:03 AM, Zhu Yanjun wrote:
> > In the function xdp_umem_pin_pages, if npgs != umem->npgs and
> > npgs >= 0, the function xdp_umem_unpin_pages is called. In this
> > function, kfree is called to handle umem->pgs, and then in the
> > function xdp_umem_pin_pages, kfree is called again to handle
> > umem->pgs. Eventually, umem->pgs is freed twice.
> >
> > Acked-by: Björn Töpel <bjorn.topel@intel.com>
> > Signed-off-by: Zhu Yanjun <yanjun.zhu@intel.com>
>
> Please also fix up the commit log according to Bjorn's prior feedback [0].
> If it's just a cleanup, it should state so, the commit message right now
> makes it sound like an actual double free bug.

The umem->pgs is actually freed twice. Since umem->pgs is set to NULL
after the first kfree,
the second kfree would not trigger call trace.
IMO, the commit log is very clear about this.

Zhu Yanjun
>
>    [0] https://lore.kernel.org/netdev/0fef898d-cf5e-ef1b-6c35-c98669e9e0ed@intel.com/

  reply	other threads:[~2020-12-09  4:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  5:03 [PATCH v2 1/1] xdp: avoid calling kfree twice Zhu Yanjun
2020-12-08 17:12 ` Daniel Borkmann
2020-12-09  4:30   ` Zhu Yanjun [this message]
2020-12-09 10:44     ` Toke Høiland-Jørgensen
2020-12-10  4:34       ` Zhu Yanjun

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='CAD=hENc8CmxdPeWbQ=4GFdtQCoCqUc87xS5sq+VePZEGC2-Z6g@mail.gmail.com' \
    --to=zyjzyj2000@gmail.com \
    --cc=bjorn.topel@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=jonathan.lemon@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=yanjun.zhu@intel.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.