mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 05:44:45 +01:00
nfs: properly disallow delegation requests on directories
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: e6d28ebc17 ("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>
Link: https://patch.msgid.link/20260107-setlease-6-19-v1-1-85f034abcc57@kernel.org
Tested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
cab0123751
commit
10dcd51106
2 changed files with 1 additions and 2 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue