From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796014466; b=lVXtSKDo1ElOm4EC1mJ8oxrqzwmsI5xXYX+i00492mqGAIQx/wBlCwXyG9/nvwrmOVl8 ggnxFVs39ttJnzXXRLoah3U6lQJW4ZqDtY5Fz0rpLsq37QJyZTwAg+VpCWe0smtNrRN1+ n2Bf2mjzRuwwGvxX4Nqauw0buVxv1CKDSetJtifsone1kgEz/5z+c7khARLyIAceqSgMp OmZrylG+SwuVQPVrAntwkRd3LHo4FnwNunpm3wNSCmvVskU0RiXgdKdwVHf3VLVsoA8PZ BEWlAwKuAUrjqjYPD9pmDIO62r62F77LIOIvkY77xyNgcBK55eShAW8VekOUwswggaw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796014466; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:Content-Language:Organization: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=hiwPwEo1eUu4NseYrMvFKs1f0HiwSyDgUaOVT83TCcc=; b=mSGqCIzai0fCtevo8sdsQo6oOfD7ic+N1tM+RpWPNntSEUAWULUU2mahJUt96FIbb+kA lOSiPmvBebTcd2lyxq7YIo+5gT/kUt+xKsnUT/dMKQCDjMjMDb6PagELur3mbLMX5PaEu NLIGGs75ngSU7YIYRNHhOvBkt/ZxDIHkUfAz75ZsXf+G/jjmCTcDN/Vt+ojHzm7CmXCX1 Z0dfffnk1wAYdWyzguy4oY+nNAFVFn4zRBh8gGF28fosxQbN/G4SP8suS4B29qpNGJP2a dGEVhFt2Jpof9x39YEUObUAkncohCVDfJ7H3yUTonrhcjKqgrpOYcJk9jnJHMfIkhhw== 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=TzNlC8D6; arc=none smtp.remote-ip=100.103.45.18 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 53291606A33B; Mon, 30 Nov 2026 04:54:26 +0000 (UTC) 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=TzNlC8D6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EE0E1F0092A; Mon, 30 Nov 2026 04:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796014465; bh=hiwPwEo1eUu4NseYrMvFKs1f0HiwSyDgUaOVT83TCcc=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=TzNlC8D6jYy5xUwH5LzmKtbEXW2tztqfRokwedVDtHd15bEBt6MGT1RJwUEXR/qUa 0UAfiGpPGupCfxLv87YEqlq49s07u+iY1DmDul8dgdoDZrUai+bilJmC9Tvb2vsgYY wjK8lPB7LR0iM3x5HDPxzECQf25DLZqd2SBiv5woYuB9AGU1kO2zwKMeCE50ho3VM/ AqUivB9Q9Jg9OpDaq3a1Z5Ufg8EqGSa+it20lJoGT1iAG3R0/a4z+DUaNNWYWXQL5q +bYXmQHykc9jKZvbf4+ZxZndPVdAP4+QrMrrdRlvI87mkrmbes6ZcA4QqwUcWDflul 32A+7Ky/f2zgg== Message-ID: Date: Mon, 30 Nov 2026 13:54:23 +0900 X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/4] null_blk: reject zone counts that overflow unsigned int To: Yingjie Wang , "axboe@kernel.dk" Cc: "linux-block@vger.kernel.org" , "stable@vger.kernel.org" References: <20261127125738.1654012-1-x-professor@outlook.com> <20261127125738.1654012-4-x-professor@outlook.com> From: Damien Le Moal Content-Language: en-US Organization: Western Digital Research In-Reply-To: <20261127125738.1654012-4-x-professor@outlook.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/27/26 21:58, Yingjie Wang wrote: > null_init_zoned_dev() calculates the zone count from sector_t values but > stores it in the unsigned int nr_zones field without checking the range. > For example, a size of 2^40 MiB with the default 256 MiB zone size > requires 2^32 zones. This count is truncated to zero when stored in > nr_zones. > > The resulting zero-length allocation returns ZERO_SIZE_PTR. Adjusting the > number of conventional zones then underflows zone_nr_conv to UINT_MAX, > and initializing those zones accesses invalid memory. This happens even > when the device capacity itself fits in a signed 64-bit byte count. > > Keep the calculated zone count in an unsigned long long temporary and > reject values above UINT_MAX before assigning nr_zones or allocating the > zone array. > > This bug was found by a fuzzer. > > Fixes: ca4b2a011948 ("null_blk: add zone support") > Cc: stable@vger.kernel.org > Signed-off-by: Yingjie Wang Looks good. Reviewed-by: Damien Le Moal