From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Steve French <sfrench@samba.org>,
Paulo Alcantara <pc@manguebit.org>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>,
Bharath SM <bharathsm@microsoft.com>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Dominique Martinet <asmadeus@codewreck.org>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
Hans de Goede <hansg@kernel.org>, NeilBrown <neil@brown.name>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
v9fs@lists.linux.dev, gfs2@lists.linux.dev,
ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH 1/6] nfs: properly disallow delegation requests on directories
Date: Wed, 07 Jan 2026 09:20:09 -0500 [thread overview]
Message-ID: <20260107-setlease-6-19-v1-1-85f034abcc57@kernel.org> (raw)
In-Reply-To: <20260107-setlease-6-19-v1-0-85f034abcc57@kernel.org>
Checking for S_ISREG() in nfs4_setlease() is incorrect, since that op is
never called for directories. The right way to deny lease requests on
directories is to set the ->setlease() operation to simple_nosetlease()
in the directory file_operations.
Fixes: e6d28ebc17eb ("filelock: push the S_ISREG check down to ->setlease handlers")
Reported-by: Christoph Hellwig <hch@infradead.org>
Closes: https://lore.kernel.org/linux-fsdevel/aV316LhsVSl0n9-E@infradead.org/
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfs/dir.c | 1 +
fs/nfs/nfs4file.c | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 23a78a742b619dea8b76ddf28f4f59a1c8a015e2..71df279febf797880ded19e45528c3df4cea2dde 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -66,6 +66,7 @@ const struct file_operations nfs_dir_operations = {
.open = nfs_opendir,
.release = nfs_closedir,
.fsync = nfs_fsync_dir,
+ .setlease = simple_nosetlease,
};
const struct address_space_operations nfs_dir_aops = {
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 7317f26892c5782a39660cae87ec1afea24e36c0..7f43e890d3564a000dab9365048a3e17dc96395c 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -431,8 +431,6 @@ void nfs42_ssc_unregister_ops(void)
static int nfs4_setlease(struct file *file, int arg, struct file_lease **lease,
void **priv)
{
- if (!S_ISREG(file_inode(file)->i_mode))
- return -EINVAL;
return nfs4_proc_setlease(file, arg, lease, priv);
}
--
2.52.0
next prev parent reply other threads:[~2026-01-07 14:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 14:20 [PATCH 0/6] vfs: properly deny directory leases on filesystems with special lease handling Jeff Layton
2026-01-07 14:20 ` Jeff Layton [this message]
2026-01-08 9:24 ` [PATCH 1/6] nfs: properly disallow delegation requests on directories Christoph Hellwig
2026-01-07 14:20 ` [PATCH 2/6] smb/client: properly disallow delegations " Jeff Layton
2026-01-07 14:20 ` [PATCH 3/6] 9p: don't allow delegations to be set " Jeff Layton
2026-01-07 14:20 ` [PATCH 4/6] gfs2: " Jeff Layton
2026-01-07 14:20 ` [PATCH 5/6] ceph: " Jeff Layton
2026-01-07 20:02 ` [EXTERNAL] " Viacheslav Dubeyko
2026-01-07 14:20 ` [PATCH 6/6] vboxsf: " Jeff Layton
2026-01-07 15:32 ` [PATCH 0/6] vfs: properly deny directory leases on filesystems with special lease handling Christoph Hellwig
2026-01-07 15:44 ` Jeff Layton
2026-01-12 9:55 ` Christian Brauner
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=20260107-setlease-6-19-v1-1-85f034abcc57@kernel.org \
--to=jlayton@kernel.org \
--cc=agruenba@redhat.com \
--cc=anna@kernel.org \
--cc=asmadeus@codewreck.org \
--cc=bharathsm@microsoft.com \
--cc=brauner@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=ericvh@kernel.org \
--cc=gfs2@lists.linux.dev \
--cc=hansg@kernel.org \
--cc=hch@infradead.org \
--cc=idryomov@gmail.com \
--cc=jack@suse.cz \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=neil@brown.name \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=trondmy@kernel.org \
--cc=v9fs@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=xiubli@redhat.com \
/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