From: Jan Kara <jack@suse.cz>
To: David Howells <dhowells@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Jeff Layton <jlayton@kernel.org>, Gao Xiang <xiang@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
netfs@lists.linux.dev, linux-erofs@lists.ozlabs.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfs: Fix potential circular locking through setxattr() and removexattr()
Date: Tue, 23 Jul 2024 14:57:10 +0200 [thread overview]
Message-ID: <20240723125710.mtnfaycuvdi4dpdy@quack3> (raw)
In-Reply-To: <2136178.1721725194@warthog.procyon.org.uk>
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@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-07-23 21:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 8:59 [PATCH] vfs: Fix potential circular locking through setxattr() and removexattr() David Howells
2024-07-23 10:45 ` Jan Kara
2024-07-23 11:11 ` Christian Brauner
2024-07-23 12:32 ` Jan Kara
2024-07-23 13:57 ` David Howells
2024-07-23 15:40 ` Christian Brauner
2024-07-24 13:30 ` Jan Kara
2024-07-29 15:28 ` Christian Brauner
2024-07-31 18:16 ` Jan Kara
2024-07-31 18:27 ` Matthew Wilcox
2024-07-31 18:55 ` Jan Kara
2024-07-24 1:34 ` Dave Chinner
2024-07-24 2:42 ` Matthew Wilcox
2024-07-23 12:57 ` Jan Kara [this message]
2024-07-24 8:11 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723125710.mtnfaycuvdi4dpdy@quack3 \
--to=jack@suse.cz \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netfs@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox