diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2023-10-06 10:41:36 +0900 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-10-12 22:43:52 -0500 |
commit | f43328357defc0dc9d28dbd06dc3361fd2b22e28 (patch) | |
tree | 911d8900c6d8f418be1f23eb5a396a90b6f3748b /fs | |
parent | 94f6f0550c625fab1f373bb86a6669b45e9748b3 (diff) | |
download | linux-stable-f43328357defc0dc9d28dbd06dc3361fd2b22e28.tar.gz linux-stable-f43328357defc0dc9d28dbd06dc3361fd2b22e28.tar.bz2 linux-stable-f43328357defc0dc9d28dbd06dc3361fd2b22e28.zip |
ksmbd: not allow to open file if delelete on close bit is set
Cthon test fail with the following error.
check for proper open/unlink operation
nfsjunk files before unlink:
-rwxr-xr-x 1 root root 0 9월 25 11:03 ./nfs2y8Jm9
./nfs2y8Jm9 open; unlink ret = 0
nfsjunk files after unlink:
-rwxr-xr-x 1 root root 0 9월 25 11:03 ./nfs2y8Jm9
data compare ok
nfsjunk files after close:
ls: cannot access './nfs2y8Jm9': No such file or directory
special tests failed
Cthon expect to second unlink failure when file is already unlinked.
ksmbd can not allow to open file if flags of ksmbd inode is set with
S_DEL_ON_CLS flags.
Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smb/server/vfs_cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c index c4b80ab7df74..1c5c39733652 100644 --- a/fs/smb/server/vfs_cache.c +++ b/fs/smb/server/vfs_cache.c @@ -106,7 +106,7 @@ int ksmbd_query_inode_status(struct inode *inode) ci = __ksmbd_inode_lookup(inode); if (ci) { ret = KSMBD_INODE_STATUS_OK; - if (ci->m_flags & S_DEL_PENDING) + if (ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS)) ret = KSMBD_INODE_STATUS_PENDING_DELETE; atomic_dec(&ci->m_count); } @@ -116,7 +116,7 @@ int ksmbd_query_inode_status(struct inode *inode) bool ksmbd_inode_pending_delete(struct ksmbd_file *fp) { - return (fp->f_ci->m_flags & S_DEL_PENDING); + return (fp->f_ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS)); } void ksmbd_set_inode_pending_delete(struct ksmbd_file *fp) |