Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Rustam Kovhaev <rkovhaev@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: kuba@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH] veth: fix memory leak in veth_newlink()
Date: Tue, 1 Sep 2020 15:59:44 -0700	[thread overview]
Message-ID: <20200901225944.GB239544@thinkpad> (raw)
In-Reply-To: <20200901.130127.236989626732311083.davem@davemloft.net>

On Tue, Sep 01, 2020 at 01:01:27PM -0700, David Miller wrote:
> From: Rustam Kovhaev <rkovhaev@gmail.com>
> Date: Sun, 30 Aug 2020 06:13:36 -0700
> 
> > when register_netdevice(dev) fails we should check whether struct
> > veth_rq has been allocated via ndo_init callback and free it, because,
> > depending on the code path, register_netdevice() might not call
> > priv_destructor() callback
> > 
> > Reported-and-tested-by: syzbot+59ef240dd8f0ed7598a8@syzkaller.appspotmail.com
> > Link: https://syzkaller.appspot.com/bug?extid=59ef240dd8f0ed7598a8
> > Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
> 
> I think I agree with Toshiaki here.  There is no reason why the
> rollback_registered() path of register_netdevice() should behave
> differently from the normal control flow.
> 
> Any code path that invokes ->ndo_uninit() should probably also
> invoke the priv destructor.
hi David, thank you for the review!

> 
> The question is why does the err_uninit: label of register_netdevice
> behave differently from rollback_registered()?  If there is a reason,
> it should be documented in a comment or similar.  If it is wrong,
> it should be corrected.
good question, that i do not know, i'll review it


      reply	other threads:[~2020-09-01 22:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30 13:13 [PATCH] veth: fix memory leak in veth_newlink() Rustam Kovhaev
2020-08-31  0:16 ` Toshiaki Makita
2020-08-31  0:51   ` Rustam Kovhaev
2020-08-31  1:43     ` Toshiaki Makita
2020-09-01 20:01 ` David Miller
2020-09-01 22:59   ` Rustam Kovhaev [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=20200901225944.GB239544@thinkpad \
    --to=rkovhaev@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).