lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Jul 2023 20:56:00 +0530
From:   Ritesh Harjani (IBM) <ritesh.list@...il.com>
To:     Kemeng Shi <shikemeng@...weicloud.com>, tytso@....edu,
        adilger.kernel@...ger.ca, ojaswin@...ux.ibm.com,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     shikemeng@...weicloud.com
Subject: Re: [PATCH 02/10] ext4: avoid potential data overflow in next_linear_group

Kemeng Shi <shikemeng@...weicloud.com> writes:

> ngroups is ext4_group_t (unsigned int) while next_linear_group treat it
> in int. If ngroups is bigger than max number described by int, it will
> be treat as a negative number. Then "return group + 1 >= ngroups ? 0 :
> group + 1;" may keep returning 0.
> Switch int to ext4_group_t in next_linear_group to fix the overflow.
>

Fixes: 196e402adf2e ("ext4: improve cr 0 / cr 1 group scanning")

With that feel free to add: 
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>


> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> ---
>  fs/ext4/mballoc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 90ffabac100b..33ee3991f62c 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1081,8 +1081,9 @@ static inline int should_optimize_scan(struct ext4_allocation_context *ac)
>   * Return next linear group for allocation. If linear traversal should not be
>   * performed, this function just returns the same group
>   */
> -static int
> -next_linear_group(struct ext4_allocation_context *ac, int group, int ngroups)
> +static ext4_group_t
> +next_linear_group(struct ext4_allocation_context *ac, ext4_group_t group,
> +		  ext4_group_t ngroups)
>  {
>  	if (!should_optimize_scan(ac))
>  		goto inc_and_return;
> -- 
> 2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ