From: Simon Horman <horms@kernel.org>
To: Baoli Zhang <baoli.zhang@linux.intel.com>
Cc: jv@jvosburgh.net, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
jamie.iles@oss.qualcomm.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] bonding: fix use-after-free in slave_kobj_release()
Date: Mon, 30 Nov 2026 20:10:35 +0000 [thread overview]
Message-ID: <20261130201035.GK804035@horms.kernel.org> (raw)
In-Reply-To: <20261120130814.2131659-1-baoli.zhang@linux.intel.com>
On Fri, Nov 20, 2026 at 09:08:14PM +0800, Baoli Zhang wrote:
> slave_kobj_release() dereferences slave->bond to check for 802.3ad mode
> before freeing ad_info. The slave kobject's parent is the slave device,
> not the bond, so the bond may already be gone when the release runs.
>
> Normally the last reference is put while the bond is still alive, but
> with CONFIG_DEBUG_KOBJECT_RELEASE the release is deferred and the bond
> can be freed first:
>
> BUG: KASAN: slab-use-after-free in slave_kobj_release+0xe8/0x100 [bonding]
> Read of size 4 at addr ffff888112c99118 by task kworker/9:1/60681
> Workqueue: events kobject_delayed_cleanup
> ...
> Freed by task 60681:
> kvfree+0x31/0x40
> netdev_release+0x8b/0xc0
> device_release+0xdf/0x2a0
> kobject_delayed_cleanup+0x148/0x520
>
> ad_info is only allocated in 802.3ad mode and is NULL otherwise, since
> the slave is allocated with kzalloc(), and the mode cannot be changed
> while the bond has slaves. Drop the mode check and free ad_info
> unconditionally.
>
> Fixes: b9ad3e9f5a7a ("bonding: wait for sysfs kobject destruction before freeing struct slave")
> Signed-off-by: Baoli Zhang <baoli.zhang@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
prev parent reply other threads:[~2026-11-30 20:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 13:08 [PATCH net] bonding: fix use-after-free in slave_kobj_release() Baoli Zhang
2026-11-27 8:30 ` Jiayuan Chen
2026-11-30 20:10 ` Simon Horman [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=20261130201035.GK804035@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=baoli.zhang@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jamie.iles@oss.qualcomm.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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.