From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F09AC304BDC for ; Fri, 27 Feb 2026 10:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772188694; cv=none; b=CxJ8JkGJ8avSOI/nhajw2awwqij5EqQuUFT2n0MTv/IuN27jeFdmjzEBB5uSR8vbflxxgeKu+E6Y4B0BNNiJrjyrrgLlhPDoEkIuQ7h/ZRoYiE77HiV9OvOIQkHjOHxX4sjuwYOhZfzjznNoucWdLgLBjilxi1g9Zd97kPshlfY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772188694; c=relaxed/simple; bh=D3CdrNY4TsQ8Ul99vMmmtRJORamGT+H7QEgjAxUZKzo=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=acJofL+1PFz1jitlb8nsZnj/vOxaeYQe+mpyypg4jpn5elqMYghiGxS/nmP+QiDiK8uiC9kJa8HYjlbKBh/fyRT1ERJNsbhA8uGOVxdmCbnIZ9kNKhdBgJE/Pm3rCPlNMvlIolc1Ab5kXrbUvTSmKWiuDaEqRPU9mpkgas97FQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KFPxY4wr; arc=none smtp.client-ip=95.215.58.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KFPxY4wr" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772188680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nrLRonMsnCVotmFrNK03+GHGpA++SDG71WGkPi8yPUk=; b=KFPxY4wrVLe1pzTCXQJdmsq7Vw6WG25wRwoCHbbfDRCtwF+6uNzM+L/2zsuudMhw1TQP2P 2bJCYw3puk/13mBr/5RjofiPUOlnZSPMPaVu5/6K8cnglINchOpsgLcWTaYpH2ejgMprLl cm0puH6mRPydK84hPGNbyd4NLt6k20k= Date: Fri, 27 Feb 2026 10:37:53 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Jiayuan Chen" Message-ID: TLS-Required: No Subject: Re: [PATCH net v2 1/2] bonding: fix null-ptr-deref in bond_rr_gen_slave_id() To: "Sebastian Andrzej Siewior" Cc: netdev@vger.kernel.org, jiayuna.chen@linux.dev, jiayuna.chen@shopee.com, "Jiayuan Chen" , syzbot+80e046b8da2820b6ba73@syzkaller.appspotmail.com, "Jay Vosburgh" , "Andrew Lunn" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Simon Horman" , "Alexei Starovoitov" , "Daniel Borkmann" , "Jesper Dangaard Brouer" , "John Fastabend" , "Stanislav Fomichev" , "Andrii Nakryiko" , "Eduard Zingerman" , "Martin KaFai Lau" , "Song Liu" , "Yonghong Song" , "KP Singh" , "Hao Luo" , "Jiri Olsa" , "Shuah Khan" , "Clark Williams" , "Steven Rostedt" , "Jussi Maki" , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rt-devel@lists.linux.dev In-Reply-To: <20260227102149.10ZgLF-t@linutronix.de> References: <20260227092254.272603-1-jiayuan.chen@linux.dev> <20260227092254.272603-2-jiayuan.chen@linux.dev> <20260227094558._Fna2iSe@linutronix.de> <4cc373b555ec3d6ff57037c569d12966a8b701db@linux.dev> <20260227102149.10ZgLF-t@linutronix.de> X-Migadu-Flow: FLOW_OUT February 27, 2026 at 18:21, "Sebastian Andrzej Siewior" wrote: >=20 >=20On 2026-02-27 10:17:29 [+0000], Jiayuan Chen wrote: >=20 >=20>=20 >=20> bond_mode can be changed after device creation via sysfs or netlink= , a bond created > > in active-backup mode can later be switched to round-robin, which me= ans the allocation > > must not be conditional on the mode at creation time. > >=20 >=20Must the device be in down state or can this be also changed while th= e > device is up? >=20 >=20Sebastian > The mode change requires the device to be DOWN. BOND_OPT_MODE is defined = with BOND_OPTFLAG_IFDOWN, and bond_opt_check_flags() enforces this: if ((opt->flags & BOND_OPTFLAG_IFDOWN) && (bond->dev->flags & IFF_UP)) return -EBUSY; The same restriction applies to the netlink path as well. Both sysfs and = netlink go through __bond_opt_set() =E2=86=92 bond_opt_check_deps(), which enforces = BOND_OPTFLAG_IFDOWN for mode change. Attempting to change the mode while the device is UP ret= urns -EBUSY regardless of how the change is requested. So unconditional allocation in bond_init() covers all cases: whether the = device is created in round-robin mode, or switched to round-robin later (which requires being DOWN, meaning bond_open() hasn't been called with t= he new mode yet). Thanks,