Article View: linux.kernel.netdev
Article #24778Re: [PATCH net] bonding: fix use-after-free in slave_kobj_release()
From: Simon Horman
Date: Mon, 30 Nov 2026 20:10
Date: Mon, 30 Nov 2026 20:10
29 lines
8856 bytes
8856 bytes
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>
Technical Details
Message-ID:
<20261130201035.GK804035@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374441-linux-kernel-netdev=dewy.ruReferences:
<20261120130814.2131659-1-baoli.zhang@linux.intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374441-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] bonding: fix use-after-free in slave_kobj_release() Date: Mon, 30 Nov 2026 20:10:35 +0000 Organization: Usenet Network Message-ID: <20261130201035.GK804035@horms.kernel.org> References: <20261120130814.2131659-1-baoli.zhang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1527218"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:SWkCIqD7EcaAk4Dst9i6GFDKOd0= sha256:cVRbjP7FkCd47HwnsUwQ645rJnB2ootxcMnH/+CeOO4= sha1:Np6yP+RLd4RAkZtot1BAkyjl+Tc= sha256:1iljXniUkaEk4OUYu9JDeyCYtnTi+lzb+R6IQyFmv7c= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B8116126007; Mon, 30 Nov 2026 23:11:05 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uCCbu2y2VrRs; Mon, 30 Nov 2026 23:10:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374441-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 3EEC3125FFC; Mon, 30 Nov 2026 23:10:48 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id B8D6628F1C; Mon, 30 Nov 2026 20:10:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796069441; b=KkrQn3LpYpmqNODiP3SlDtmwbXBMNRLkBDAvPXB8UUn/7crEoJ0AeaSX2E7ZwUv6gCN0 K3ZZuLM947TBZrBEqkH9WmJklA8wY0flNnRLZ0gFMw425atTMGyxiXM91A+NpzBWgRvzW MTa12lMOrcHlsa4e3X5y01Pk4B7CO/EHovF6ZaQo5ktCfG0ZEf8UMEdgmQRfT6Cd4gzjN s7CZKBFM7yqxwmfJac7ZAT3dSMzRYTgm56pbr5uYBYILlSmkKWwPpFAdMR3hHTQv1mRg/ Myr9D2uHomTFHzwy5WutldsRYKeXEUItFo3c5lEX1DTNL54oP5iPQUE+GAnoBfsymag== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796069441; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=aQah7BckDXorQ1iyAU4VKCaYhN5NcZbY1uWeM/x6n/I=; b=yg/HdA+SnCUT1GdyGrt0suLk/jhES9fEpAyu5OtBrgqVfcPz05/PnY49VsBsZr6IgGH2 Bc3eDlUqGY507ZOX1DGjhhWe7xbtY/xcYhbUdkh5pBukzbP5RqFa8BO4wNDLs/QBJcPKX qwW/QAVKmWYPT5mmCsyg3hsKgi4aF37C/WyJBg05aAtCsjZ+m6t3lSEFM+R4OkxurparQ OlAgfaIYLHN9NmBbNxzzwwDkmmbuhyX5JUgnccJ3zjtd4mH3udIHJ8T3BaPAEXq9AGA9h 9OOgpOS+Xk2f7o3ks5ytZx8RH2F8hXtp/IxdTF+avhKZ1RVrQfdbKuq7omPj0IRoZFg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=meAEgO1v; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8C98606A332; Mon, 30 Nov 2026 20:10:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=meAEgO1v X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796069440; b=pqzKAYlWKi9RK9N9Zs2xaRDdV5ne3pN2ttmbxV+qDdemypokOBZccZg+5Ech0tmQN8WX U7WlItGi4Pf3KVQCjOZEfF9xZXFHYP66WpZfgF9zN8t+upMdoKwq29k0ZJY/wpnJWzJrX bYeEWGFhuMjKXTxHmzffyKmf1xQIdn9HQpl+XsWvkXly4GGWWCgo+LUfL+yZ9ohJ/vN+B wztEuVv0OEYpJU1n2JHb1Qlmm2AA73DCoARI44SlLzKhp06QwQbaj0dg9T4nMQCBrcATF AnIkn90G4BYU7i9ku7rPRaTOep2zq/p3F7tJ3ciAPQHus1vJ9+e80JC4kYZd/cLgN/Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796069440; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=aQah7BckDXorQ1iyAU4VKCaYhN5NcZbY1uWeM/x6n/I=; b=g8S9qQUlxqVZA0uBupLfk4PcuCABZP7tJD07TYOw+FoGDZ/kT9J8jWo0jupbFXVG2Z/V 7zYsbLyUAScZO6WzsFclo3OEOCcXJ1xO8+BodEeDTF11PYR3Ywc6uq5HAC2naxQv2VH2z ZSkQmkPUjcgYP+PG91xq9f3Kv6LhhDKxiGTThKKuSVVnJWvjn/7QWll6TtnBrfuPzT8xf bUkXkMBm5MOttw93Rb8wE00K4gCWYIBJumLAogAVZGVANhiSMmmIljuzuzwUU7B3++1MR ZJCGoO86nr6Hxca3p8s8WZ8SKkKd6xMe5eopeJz9bwtI9XncTI0zSmnrzBgZ/Z7oUWQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=meAEgO1v; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10A58606A320; Mon, 30 Nov 2026 20:10:40 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95CE81F0089A; Mon, 30 Nov 2026 20:10:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796069439; bh=aQah7BckDXorQ1iyAU4VKCaYhN5NcZbY1uWeM/x6n/I=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=meAEgO1vy7PswQ5l6RncaRR13WXZAUKyNphY3Z9mzzQaTf4gGALjo9T7X+6klMOaA Mw3kWoNjLiBS+9mbLTGsmR4Q8PoET6/I/acembvrjtX83yCZaaFg7sxaJSpWGKRD6j y65w0hC52mP6YHKQn/boXbyrWmaJ2l4xhMdhtQ3LoZw0mIKj5EIO7pD88czA7rqhaH tuh+WcIrPgv7vAw6z9YxB/xOuWiEPrdbPvdWV0HGWJDLuxj0xADoRadfUsc24NTAkR E+y7biZXjoU35IOV0LgR2UFvRgt2wM0pV33IGMED+PIERx1n/eD7+/QwSssFswRDQp vKWYg5zikylhg== X-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 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261120130814.2131659-1-baoli.zhang@linux.intel.com>