All of lore.kernel.org
 help / color / mirror / Atom feed
From: willemb@google.com
To: Lin Jiapeng <ljp1205831794@gmail.com>,
	jv@jvosburgh.net, andrew+netdev@lunn.ch,  davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	 sfeldma@cumulusnetworks.com, netdev@vger.kernel.org
Cc: Lin Jiapeng <jiapenglin@tencent.com>,
	TencentOS Corvus AI <corvus@tencent.com>
Subject: Re: [PATCH net v3] bonding: unbind 802.3ad slaves on enslave failure
Date: Tue, 01 Dec 2026 23:04:26 -0500	[thread overview]
Message-ID: <willemb.375bf3e63cc@google.com> (raw)
In-Reply-To: <20261126082257.46411-1-ljp1205831794@gmail.com>

Lin Jiapeng wrote:
> From: Lin Jiapeng <jiapenglin@tencent.com>

> The 802.3ad enslave path binds a slave's port before the slave is
> published in the bond's lower list. The periodic state machine can
> select the port and attach it to a LAG while enslavement is still in
> progress, including while NETDEV_CHANGEUPPER notifiers are running.

> If enslavement fails, rollback can free ad_slave_info without unbinding
> its port and leave later LAG processing with a dangling pointer. This
> affects both a failed upper-link notification and later failures such
> as bond_sysfs_slave_add(). A test-only kretprobe forces the latter to
> return -ENOMEM, after which KASAN reports:
>       BUG: KASAN: slab-use-after-free in  
> ad_agg_selection_logic+0x1a0d/0x1fa0
>       Read of size 1 by task kworker/u16:0/13
>       Freed by task 110:
>         kfree
>         slave_kobj_release
>         kobject_put
>         bond_enslave

> Bind the port only after bond_master_upper_dev_link() has succeeded, so
> an upper-link failure never binds anything and cannot race with the
> state machine on a port the notifier rollback has already unlisted.
> On failures after publication, drain the RX handler, unbind while the
> slave is still listed, then unlink, re-evaluate the carrier the way
> __bond_release_one() does, and rebuild the slave array after aggregator
> changes. Earlier unpublished failures keep their previous behaviour.

> Fixes: 07699f9a7c8d ("bonding: add sysfs /slave dir for bond slave  
> devices.")
> Reported-by: TencentOS Corvus AI <corvus@tencent.com>
> Signed-off-by: Lin Jiapeng <jiapenglin@tencent.com>
> Link:  
> https://lore.kernel.org/netdev/20261124024319.52145-1-ljp1205831794@gmail.com/

Please rebase v3 on current net and repost.

      reply	other threads:[~2026-12-02  4:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  8:22 [PATCH net v3] bonding: unbind 802.3ad slaves on enslave failure Lin Jiapeng
2026-12-02  4:04 ` willemb [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=willemb.375bf3e63cc@google.com \
    --to=willemb@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=corvus@tencent.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jiapenglin@tencent.com \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=ljp1205831794@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sfeldma@cumulusnetworks.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.