[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aifdv7l2aomyyjdldpmhucnujstfzadjafy2s4kjqq5ecsk2hf@q4nph7xhemrg>
Date: Mon, 3 Nov 2025 12:44:25 +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>, Taotao Chen <chentaotao@...iglobal.com>,
Jeff Layton <jlayton@...nel.org>, Jan Kara <jack@...e.cz>, NeilBrown <neil@...wn.name>,
linux-kernel@...r.kernel.org, syzbot+4e49728ec1cbaf3b91d2@...kaller.appspotmail.com
Subject: Re: [PATCH] Fix a drop_nlink warning in minix_rmdir
On Sun 02-11-25 14:52:39, Jori Koolstra wrote:
> Syzbot found a drop_nlink warning that is triggered by an easy to
> detect nlink corruption of a directory. This patch adds a sanity check
> to minix_rmdir to prevent the warning and instead return EFSCORRUPTED to
> the caller.
>
> The changes were tested using the syzbot reproducer as well as local
> testing.
>
> Signed-off-by: Jori Koolstra <jkoolstra@...all.nl>
> Reported-by: syzbot+4e49728ec1cbaf3b91d2@...kaller.appspotmail.com
> Closes: https://syzbot.org/bug?extid=4e49728ec1cbaf3b91d2
Looks good, just one nit below. With that fixed feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
> diff --git a/fs/minix/namei.c b/fs/minix/namei.c
> index 8938536d8d3c..a8d5a7e22b7b 100644
> --- a/fs/minix/namei.c
> +++ b/fs/minix/namei.c
> @@ -161,15 +161,25 @@ static int minix_unlink(struct inode * dir, struct dentry *dentry)
> static int minix_rmdir(struct inode * dir, struct dentry *dentry)
> {
> struct inode * inode = d_inode(dentry);
> - int err = -ENOTEMPTY;
> -
> - if (minix_empty_dir(inode)) {
> - err = minix_unlink(dir, dentry);
> - if (!err) {
> - inode_dec_link_count(dir);
> - inode_dec_link_count(inode);
> - }
> + int err = -EFSCORRUPTED;
> +
> + if (dir->i_nlink <= 2) {
> + printk(KERN_CRIT "minix-fs error: directory inode has "
> + "corrupted nlink");
We usually print inode number (dir->i_ino) with such errors in minix.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists