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]
Message-ID: <ws2bd4dkvo7es7urxrmgk7a26f7ohivwhrpdl6nxsuh34dtxvl@a7t6mtdshimz>
Date: Mon, 24 Nov 2025 18:29:44 +0100
From: Jan Kara <jack@...e.cz>
To: Jori Koolstra <jkoolstra@...all.nl>
Cc: Christian Brauner <brauner@...nel.org>, 
	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>, Jan Kara <jack@...e.cz>, Taotao Chen <chentaotao@...iglobal.com>, 
	Shuah Khan <skhan@...uxfoundation.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] Corrected errno in minix_new_inode

On Mon 17-11-25 23:05:20, Jori Koolstra wrote:
> The cases (!j || j > sbi->s_ninodes) can never occur unless the
> filesystem is broken, so this should not return ENOSPC, but
> EFSCORRUPTED.

I agree with this.

> I also removed a redundant assignment: sbi->s_imap_blocks can never be
> 0, so j is always immediately overwritten.

OK, but this will make the compiler likely unhappy (because it doesn't know
s_imap_blocks cannot be 0) and generally the code will be less
self-containted. So in the spirit of defensive programming I'd leave the
assignment there.

								Honza

> 
> Signed-off-by: Jori Koolstra <jkoolstra@...all.nl>
> ---
>  fs/minix/bitmap.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
> index 7da66ca184f4..9d9c2819b22b 100644
> --- a/fs/minix/bitmap.c
> +++ b/fs/minix/bitmap.c
> @@ -222,7 +222,6 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode)
>  
>  	if (!inode)
>  		return ERR_PTR(-ENOMEM);
> -	j = bits_per_zone;
>  	bh = NULL;
>  	spin_lock(&bitmap_lock);
>  	for (i = 0; i < sbi->s_imap_blocks; i++) {
> @@ -247,7 +246,7 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode)
>  	j += i * bits_per_zone;
>  	if (!j || j > sbi->s_ninodes) {
>  		iput(inode);
> -		return ERR_PTR(-ENOSPC);
> +		return ERR_PTR(-EFSCORRUPTED);
>  	}
>  	inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
>  	inode->i_ino = j;
> 
> base-commit: 0d534518ce87317e884dbd1485111b0f1606a194
> -- 
> 2.51.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ