diff options
| author | Paulo Alcantara <pc@manguebit.com> | 2025-02-16 18:02:47 -0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-02-27 04:30:22 -0800 |
| commit | a1b5ed0a6144c17fd11e369a0f070bb2e881a2c5 (patch) | |
| tree | 7a2d8f1224e58e7f51c64d3c4d7d4c5fe677193d /fs | |
| parent | cd1c4113ba9e100d889a5b702c5b42c62026bf88 (diff) | |
| download | linux-a1b5ed0a6144c17fd11e369a0f070bb2e881a2c5.tar.gz linux-a1b5ed0a6144c17fd11e369a0f070bb2e881a2c5.tar.bz2 linux-a1b5ed0a6144c17fd11e369a0f070bb2e881a2c5.zip | |
smb: client: fix chmod(2) regression with ATTR_READONLY
commit 654292a0b264e9b8c51b98394146218a21612aa1 upstream.
When the user sets a file or directory as read-only (e.g. ~S_IWUGO),
the client will set the ATTR_READONLY attribute by sending an
SMB2_SET_INFO request to the server in cifs_setattr_{,nounix}(), but
cifsInodeInfo::cifsAttrs will be left unchanged as the client will
only update the new file attributes in the next call to
{smb311_posix,cifs}_get_inode_info() with the new metadata filled in
@data parameter.
Commit a18280e7fdea ("smb: cilent: set reparse mount points as
automounts") mistakenly removed the @data NULL check when calling
is_inode_cache_good(), which broke the above case as the new
ATTR_READONLY attribute would end up not being updated on files with a
read lease.
Fix this by updating the inode whenever we have cached metadata in
@data parameter.
Reported-by: Horst Reiterer <horst.reiterer@fabasoft.com>
Closes: https://lore.kernel.org/r/85a16504e09147a195ac0aac1c801280@fabasoft.com
Fixes: a18280e7fdea ("smb: cilent: set reparse mount points as automounts")
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/smb/client/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index fafc07e38663..e11e67af760f 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -1381,7 +1381,7 @@ int cifs_get_inode_info(struct inode **inode, struct cifs_fattr fattr = {}; int rc; - if (is_inode_cache_good(*inode)) { + if (!data && is_inode_cache_good(*inode)) { cifs_dbg(FYI, "No need to revalidate cached inode sizes\n"); return 0; } @@ -1480,7 +1480,7 @@ int smb311_posix_get_inode_info(struct inode **inode, struct cifs_fattr fattr = {}; int rc; - if (is_inode_cache_good(*inode)) { + if (!data && is_inode_cache_good(*inode)) { cifs_dbg(FYI, "No need to revalidate cached inode sizes\n"); return 0; } |
