]> git.ipfire.org Git - thirdparty/linux.git/commit
nfs: properly disallow delegation requests on directories
authorJeff Layton <jlayton@kernel.org>
Wed, 7 Jan 2026 14:20:09 +0000 (09:20 -0500)
committerChristian Brauner <brauner@kernel.org>
Mon, 12 Jan 2026 09:54:46 +0000 (10:54 +0100)
commit10dcd5110678c6b241bbcf062f72ea14fb3597f3
tree3c1e14b4e9f3da34eb77d60c952bb6e00b377768
parentcab012375122304a6343c1ed09404e5143b9dc01
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: 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>
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>
fs/nfs/dir.c
fs/nfs/nfs4file.c