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] [day] [month] [year] [list]
Message-ID: <20241202122818.4zzg6lmspgzukkwv@quack3>
Date: Mon, 2 Dec 2024 13:28:18 +0100
From: Jan Kara <jack@...e.cz>
To: Leo Stone <leocstone@...il.com>
Cc: syzbot+5df2d3fa14f2d3e49305@...kaller.appspotmail.com, jack@...e.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] udf: Prevent rmdir of deleted directories

On Sun 01-12-24 16:41:02, Leo Stone wrote:
> The syzbot reproducer mounts a UDF image with the undelete option
> enabled. It then creates a directory, and eventually attempts to call
> rmdir on it 65 times. Because the undelete option is set, the
> directory still gets found in udf_fiiter_find_entry(), and the link
> count of its parent directory is decremented until it triggers the
> warning in drop_nlink().
> 
> Prevent directories with the FID_FILE_CHAR_DELETED flag set from being
> deleted again.
> 
> #syz test
> 
> Reported-by: syzbot+5df2d3fa14f2d3e49305@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=5df2d3fa14f2d3e49305
> Signed-off-by: Leo Stone <leocstone@...il.com>

Thanks for looking into this but the fix is already queued into my tree and
I'll send it to Linus today.

								Honza

> ---
>  fs/udf/namei.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 78a603129dd5..0a577b7459de 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -504,6 +504,12 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
>  	if (ret)
>  		goto out;
>  
> +	if (iter.fi.fileCharacteristics & FID_FILE_CHAR_DELETED) {
> +		udf_warn(inode->i_sb,
> +			 "tried to rmdir a directory that was already deleted\n");
> +		ret = -ENOENT;
> +		goto end_rmdir;
> +	}
>  	ret = -EFSCORRUPTED;
>  	tloc = lelb_to_cpu(iter.fi.icb.extLocation);
>  	if (udf_get_lb_pblock(dir->i_sb, &tloc, 0) != inode->i_ino)
> -- 
> 2.43.0
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ