[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240723125710.mtnfaycuvdi4dpdy@quack3>
Date: Tue, 23 Jul 2024 14:57:10 +0200
From: Jan Kara <jack@...e.cz>
To: David Howells <dhowells@...hat.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>, Gao Xiang <xiang@...nel.org>,
Matthew Wilcox <willy@...radead.org>, netfs@...ts.linux.dev,
linux-erofs@...ts.ozlabs.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vfs: Fix potential circular locking through setxattr()
and removexattr()
Regarding the contents of the change itself:
On Tue 23-07-24 09:59:54, David Howells wrote:
> @@ -954,15 +952,23 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
> SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
> {
> struct fd f = fdget(fd);
> + char kname[XATTR_NAME_MAX + 1];
> int error = -EBADF;
>
> if (!f.file)
> return error;
> audit_file(f.file);
> +
> + error = strncpy_from_user(kname, name, sizeof(kname));
> + if (error == 0 || error == sizeof(kname))
> + error = -ERANGE;
> + if (error < 0)
> + return error;
Missing fdput() here.
> +
> error = mnt_want_write_file(f.file);
> if (!error) {
> error = removexattr(file_mnt_idmap(f.file),
> - f.file->f_path.dentry, name);
> + f.file->f_path.dentry, kname);
> mnt_drop_write_file(f.file);
> }
> fdput(f);
Otherwise the patch looks good to me.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists