summaryrefslogtreecommitdiff
path: root/fs/smb/client/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-11-23 08:54:14 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2024-11-23 08:54:14 +0300
commit228a1157fb9fec47eb135b51c0202b574e079ebf (patch)
tree27e1e1bf2ceef0dc100f259d3088017c32b5ad8c /fs/smb/client/inode.c
parente7675238b9bf4db0b872d5dbcd53efa31914c98f (diff)
parenta9685b409a03b73d2980bbfa53eb47555802d0a9 (diff)
downloadlinux-228a1157fb9fec47eb135b51c0202b574e079ebf.tar.xz
Merge tag '6.13-rc-part1-SMB3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client updates from Steve French: - Fix two SMB3.1.1 POSIX Extensions problems - Fixes for special file handling (symlinks and FIFOs) - Improve compounding - Four cleanup patches - Fix use after free in signing - Add support for handling namespaces for reconnect related upcalls (e.g. for DNS names resolution and auth) - Fix various directory lease problems (directory entry caching), including some important potential use after frees * tag '6.13-rc-part1-SMB3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb: prevent use-after-free due to open_cached_dir error paths smb: Don't leak cfid when reconnect races with open_cached_dir smb: client: handle max length for SMB symlinks smb: client: get rid of bounds check in SMB2_ioctl_init() smb: client: improve compound padding in encryption smb3: request handle caching when caching directories cifs: Recognize SFU char/block devices created by Windows NFS server on Windows Server <<2012 CIFS: New mount option for cifs.upcall namespace resolution smb/client: Prevent error pointer dereference fs/smb/client: implement chmod() for SMB3 POSIX Extensions smb: cached directories can be more than root file handle smb: client: fix use-after-free of signing key smb: client: Use str_yes_no() helper function smb: client: memcpy() with surrounding object base address cifs: Remove pre-historic unused CIFSSMBCopy
Diffstat (limited to 'fs/smb/client/inode.c')
-rw-r--r--fs/smb/client/inode.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index eff3f57235ee..de8063b44072 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -598,6 +598,17 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
fattr->cf_rdev = MKDEV(mjr, mnr);
+ } else if (bytes_read == 16) {
+ /*
+ * Windows NFS server before Windows Server 2012
+ * stores major and minor number in SFU-modified
+ * style, just as 32-bit numbers. Recognize it.
+ */
+ __u32 mjr; /* major */
+ __u32 mnr; /* minor */
+ mjr = le32_to_cpu(*(__le32 *)(pbuf+8));
+ mnr = le32_to_cpu(*(__le32 *)(pbuf+12));
+ fattr->cf_rdev = MKDEV(mjr, mnr);
}
} else if (memcmp("IntxCHR\0", pbuf, 8) == 0) {
cifs_dbg(FYI, "Char device\n");
@@ -610,6 +621,17 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
fattr->cf_rdev = MKDEV(mjr, mnr);
+ } else if (bytes_read == 16) {
+ /*
+ * Windows NFS server before Windows Server 2012
+ * stores major and minor number in SFU-modified
+ * style, just as 32-bit numbers. Recognize it.
+ */
+ __u32 mjr; /* major */
+ __u32 mnr; /* minor */
+ mjr = le32_to_cpu(*(__le32 *)(pbuf+8));
+ mnr = le32_to_cpu(*(__le32 *)(pbuf+12));
+ fattr->cf_rdev = MKDEV(mjr, mnr);
}
} else if (memcmp("LnxSOCK", pbuf, 8) == 0) {
cifs_dbg(FYI, "Socket\n");
@@ -3062,6 +3084,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
int rc = -EACCES;
__u32 dosattr = 0;
__u64 mode = NO_CHANGE_64;
+ bool posix = cifs_sb_master_tcon(cifs_sb)->posix_extensions;
xid = get_xid();
@@ -3152,7 +3175,8 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
mode = attrs->ia_mode;
rc = 0;
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) ||
- (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID)) {
+ (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) ||
+ posix) {
rc = id_mode_to_cifs_acl(inode, full_path, &mode,
INVALID_UID, INVALID_GID);
if (rc) {