All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Jiri Pirko <jiri@mellanox.com>,
	YueHaibing <yuehaibing@huawei.com>,
	Shaochun Chen <cscnull@gmail.com>
Subject: Re: [Patch net v2] genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()
Date: Wed, 10 Jun 2020 21:14:10 -0700	[thread overview]
Message-ID: <CAM_iQpVU14ky_L7PqhyB3_OSPpbY5ZKLn=GonLU88GcN5fEoHw@mail.gmail.com> (raw)
In-Reply-To: <20200610142700.GA2174714@splinter>

On Wed, Jun 10, 2020 at 7:27 AM Ido Schimmel <idosch@idosch.org> wrote:
> > @@ -548,7 +591,7 @@ static int genl_lock_done(struct netlink_callback *cb)
> >               rc = ops->done(cb);
> >               genl_unlock();
> >       }
> > -     genl_family_rcv_msg_attrs_free(info->family, info->attrs, true);
> > +     genl_family_rcv_msg_attrs_free(info->family, info->attrs, false);
>
> Cong,
>
> This seems to result in a memory leak because 'info->attrs' is never
> freed in the non-parallel case.
>
> Both the parallel and non-parallel code paths call genl_start() which
> allocates the array, but the latter calls genl_lock_done() as its done()
> callback which never frees it.

Good catch! Looks like I should just revert the above chunk. The
last parameter of genl_family_rcv_msg_attrs_free() is just confusing,
genl_lock_done() is clearly not parallel at all..

I will take a deeper look and send out a patch tomorrow.

Thanks!

      reply	other threads:[~2020-06-11  4:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  4:49 [Patch net v2] genetlink: fix memory leaks in genl_family_rcv_msg_dumpit() Cong Wang
2020-06-04 22:36 ` David Miller
2020-06-10 14:27 ` Ido Schimmel
2020-06-11  4:14   ` Cong Wang [this message]

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='CAM_iQpVU14ky_L7PqhyB3_OSPpbY5ZKLn=GonLU88GcN5fEoHw@mail.gmail.com' \
    --to=xiyou.wangcong@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=cscnull@gmail.com \
    --cc=fw@strlen.de \
    --cc=idosch@idosch.org \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=syzbot+21f04f481f449c8db840@syzkaller.appspotmail.com \
    --cc=yuehaibing@huawei.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.