mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Huang Guobin <huangguobin4@huawei.com>
Cc: <j.vosburgh@gmail.com>, <vfalico@gmail.com>, <andy@greyhouse.net>,
	<davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next v2] bonding: Fix a use-after-free problem when bond_sysfs_slave_add() failed
Date: Wed, 3 Nov 2021 16:27:10 -0700	[thread overview]
Message-ID: <20211103162710.74755593@kicinski-fedora-PC1C0HJN> (raw)
In-Reply-To: <1635845853-4259-1-git-send-email-huangguobin4@huawei.com>

On Tue, 2 Nov 2021 17:37:33 +0800 Huang Guobin wrote:
> When I do fuzz test for bonding device interface, I got the following
> use-after-free Calltrace:

> Put new_slave in bond_sysfs_slave_add() will cause use-after-free problems
> when new_slave is accessed in the subsequent error handling process. Since
> new_slave will be put in the subsequent error handling process, remove the
> unnecessary put to fix it.
> In addition, when sysfs_create_file() fails, if some files have been crea-
> ted successfully, we need to call sysfs_remove_file() to remove them.
> Since there are sysfs_create_files() & sysfs_remove_files() can be used,
> use these two functions instead.
> 
> Fixes: 7afcaec49696 (bonding: use kobject_put instead of _del after kobject_add)
> Signed-off-by: Huang Guobin <huangguobin4@huawei.com>

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

      reply	other threads:[~2021-11-03 23:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02  9:37 Huang Guobin
2021-11-03 23:27 ` Jakub Kicinski [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=20211103162710.74755593@kicinski-fedora-PC1C0HJN \
    --to=kuba@kernel.org \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=huangguobin4@huawei.com \
    --cc=j.vosburgh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@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

all inboxes | Powered by JetHome®