From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796184268; b=H8voON+XNmEc4JyBU3P5pomZ05hVvOF13A6lTbgMmBIcUy+rPjMR80SJ46MTEMvbiUOR RcbGtsqJYzrzJYE9eQGYvzUp0GJk/bYaxXJydoWi3LHGJfM8pDS5flQ0oV0lbLwK4pGoy luZfUIrH1Ald/L+8LTsU2GuUhiEASAUP2BapSBe3ijtqB6MbBe1huEKTNyjIpwvrtTkWv DKm0u9K/bRJSKjzVZrhENRqAXB7hijuucXC6O5Fprk6of2T/wygvtdKNT9Yqt43qY0xYt hF7ujcQUIbisdVTN0pbHyBA0MkCrOaFeVOFrJMsiOduILd98A4HPFKZ/rLuDvoCtMBQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796184268; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=mdHW4f5NgxpnjtBWatXjUzJ0ZkD4ubU4jCLki6VjsXo=; b=pD/V8QyFgBmFwEseqAMj2c07k70oloHis2UXKtoVltiSj/5gePNWUTtiMw8Js388PfZ7 PgppL52e/TqIEYtDf8/maiKigbrLLo/UAmKkpMakis7qvvdbPVecGntvPc24U+5S623Xb ZjO/NKqymtIX5S3W2LL1yogUW6trFlfr5GnyRE1ae4hVBK3RHq2H6hRerG4+J1yS3m0vg MxCy+28wLpvW7VpOmpOZx4iLOCyLfwNPzxJWL2MlGRavguv/Qph1NZC0jwKNjmeX/jLQc HJyJ570wr5Rw+p5Pf61VflH3CICbryjruOZwBoxfNFIcyw2DIkYDF45d3XzBYnMA4xg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--willemb.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=ZJ9Cm61r; arc=none smtp.remote-ip=209.85.219.71 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF372606A323 for ; Wed, 2 Dec 2026 04:04:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF372606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--willemb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=ZJ9Cm61r Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-92104826f9bso226676826d6.1 for ; Tue, 01 Dec 2026 20:04:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796184267; x=1796789067; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mdHW4f5NgxpnjtBWatXjUzJ0ZkD4ubU4jCLki6VjsXo=; b=ZJ9Cm61rVPZe2hWOyiCKWhKRt8IKpSMCyqcVh7OzCpSx5/JacHGkklZ+2nHsfdlDFB dEz1mWqYdXWueNOnjZhOuH9NrvhIDT+oDnIiixz6p0ZiMic8RpRi23Zgvn/2tDCAOREZ i+r1dP3Yeguojh9GXqTczhYvnbmTF6bkshOAK3r4sZIhKFjh+LC/Raddw2yHvTRNlE2S TXHhVjq5PNRaD4ndWm6reupX4jZWuBUBEngbKxiW68MjAO7Wok+4yTmLkBBt5kE+saG8 0jDSZw4HngEKgaOjKupKk6cgIRFQ3Lf7hl595BCU82WUo1QYDG2xHXTvYIUXlrsHHdDy 79Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796184267; x=1796789067; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mdHW4f5NgxpnjtBWatXjUzJ0ZkD4ubU4jCLki6VjsXo=; b=CUJiLfBGPhP5dsbf9Dpc3e+HvIj0vDQU2of26hLnp5axiKgmXfTJSEtVwliTSvsrhW uoyuVsq+OXV/j/xD7zaqAig3vjfPprf3ka/elY47W4JzBrqXagoZjRO5K4GDtl5/Qac4 hHu2VKZGiBg0QjmU+8LgN2oNNJM+gnOy8lmNEoM2KIh+LR0h5F4FSjf+70ezxagsUDcU 7rfLQSFsgoHElgzkYEEDzTUG3CwiXXfX443V/59VdW2ZHS1t/wL6MdBH+rS6K03WWkER mG2qWhsgFJbjL1OIukDGin45QnOfwGof1eYule24lPcFmA1duo1Ve1MzLVmdcIwlieQR /qFA== X-Forwarded-Encrypted: i=1; AL+hErEBrgZx/CVddpZU06RdaWn+33uanbwnZd6LG6g+TnEyJTW58ShXaikkZqhX3hi8D+r7htpPj7U=@vger.kernel.org X-Gm-Message-State: APuU4Z/huiMEI9JVinWWU47qRofD+hjKAMDdRweZXu9uuhYFb0hQ0Ve6 oFSBEECcugOzFQ5jEOsLl/xi9HQrFkWKX2AzYvBbtgx495a0rYQq+qaNhQcnz/A+oEQ/ZHG1OKb Cv7gSK9BXOA== X-Received: from qvoa16.prod.google.com ([2002:a0c:e910:0:b0:921:b816:cc0b]) (user=willemb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6214:4f01:b0:91e:9b7a:7f12 with SMTP id 6a1803df08f44-92134abd48fmr574211316d6.9.1796184266634; Tue, 01 Dec 2026 20:04:26 -0800 (PST) Date: Tue, 01 Dec 2026 23:04:26 -0500 In-Reply-To: <20261126082257.46411-1-ljp1205831794@gmail.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261126082257.46411-1-ljp1205831794@gmail.com> Message-ID: Subject: Re: [PATCH net v3] bonding: unbind 802.3ad slaves on enslave failure From: willemb@google.com To: Lin Jiapeng , 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 , TencentOS Corvus AI Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes Lin Jiapeng wrote: > From: Lin Jiapeng > 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 > Signed-off-by: Lin Jiapeng > Link: > https://lore.kernel.org/netdev/20261124024319.52145-1-ljp1205831794@gmail.com/ Please rebase v3 on current net and repost.