Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'v6.12-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd

Pull smb server fixes from Steve French:

- fix querying dentry for char/block special files

- small cleanup patches

* tag 'v6.12-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
ksmbd: Correct typos in multiple comments across various files
ksmbd: fix open failure from block and char device file
ksmbd: remove unsafe_memcpy use in session setup
ksmbd: Replace one-element arrays with flexible-array members
ksmbd: fix warning: comparison of distinct pointer types lacks a cast

+30 -33
+3 -3
fs/smb/common/smb2pdu.h
··· 6 6 * Note that, due to trying to use names similar to the protocol specifications, 7 7 * there are many mixed case field names in the structures below. Although 8 8 * this does not match typical Linux kernel style, it is necessary to be 9 - * able to match against the protocol specfication. 9 + * able to match against the protocol specification. 10 10 * 11 11 * SMB2 commands 12 12 * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses ··· 491 491 __le16 ContextType; /* 2 */ 492 492 __le16 DataLength; 493 493 __le32 Reserved; 494 - /* CipherCount usally 2, but can be 3 when AES256-GCM enabled */ 494 + /* CipherCount usually 2, but can be 3 when AES256-GCM enabled */ 495 495 __le16 CipherCount; /* AES128-GCM and AES128-CCM by default */ 496 496 __le16 Ciphers[]; 497 497 } __packed; ··· 1061 1061 #define IL_IMPERSONATION cpu_to_le32(0x00000002) 1062 1062 #define IL_DELEGATE cpu_to_le32(0x00000003) 1063 1063 1064 - /* File Attrubutes */ 1064 + /* File Attributes */ 1065 1065 #define FILE_ATTRIBUTE_READONLY 0x00000001 1066 1066 #define FILE_ATTRIBUTE_HIDDEN 0x00000002 1067 1067 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
+1 -1
fs/smb/server/connection.c
··· 25 25 /** 26 26 * ksmbd_conn_free() - free resources of the connection instance 27 27 * 28 - * @conn: connection instance to be cleand up 28 + * @conn: connection instance to be cleaned up 29 29 * 30 30 * During the thread termination, the corresponding conn instance 31 31 * resources(sock/memory) are released and finally the conn object is freed.
+1 -1
fs/smb/server/ksmbd_netlink.h
··· 213 213 }; 214 214 215 215 /* 216 - * IPC Request struture to disconnect tree connection. 216 + * IPC Request structure to disconnect tree connection. 217 217 */ 218 218 struct ksmbd_tree_disconnect_request { 219 219 __u64 session_id; /* session id */
+2 -2
fs/smb/server/oplock.c
··· 796 796 /** 797 797 * smb2_lease_break_noti() - break lease when a new client request 798 798 * write lease 799 - * @opinfo: conains lease state information 799 + * @opinfo: contains lease state information 800 800 * 801 801 * Return: 0 on success, otherwise error 802 802 */ ··· 1484 1484 } 1485 1485 1486 1486 /** 1487 - * parse_lease_state() - parse lease context containted in file open request 1487 + * parse_lease_state() - parse lease context contained in file open request 1488 1488 * @open_req: buffer containing smb2 file open(create) request 1489 1489 * 1490 1490 * Return: allocated lease context object on success, otherwise NULL
+1 -1
fs/smb/server/server.c
··· 279 279 280 280 /** 281 281 * queue_ksmbd_work() - queue a smb request to worker thread queue 282 - * for proccessing smb command and sending response 282 + * for processing smb command and sending response 283 283 * @conn: connection instance 284 284 * 285 285 * read remaining data from socket create and submit work.
+16 -19
fs/smb/server/smb2pdu.c
··· 1335 1335 return rc; 1336 1336 1337 1337 sz = le16_to_cpu(rsp->SecurityBufferOffset); 1338 - chgblob = 1339 - (struct challenge_message *)((char *)&rsp->hdr.ProtocolId + sz); 1338 + chgblob = (struct challenge_message *)rsp->Buffer; 1340 1339 memset(chgblob, 0, sizeof(struct challenge_message)); 1341 1340 1342 1341 if (!work->conn->use_spnego) { ··· 1368 1369 goto out; 1369 1370 } 1370 1371 1371 - sz = le16_to_cpu(rsp->SecurityBufferOffset); 1372 - unsafe_memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, spnego_blob_len, 1373 - /* alloc is larger than blob, see smb2_allocate_rsp_buf() */); 1372 + memcpy(rsp->Buffer, spnego_blob, spnego_blob_len); 1374 1373 rsp->SecurityBufferLength = cpu_to_le16(spnego_blob_len); 1375 1374 1376 1375 out: ··· 1450 1453 if (rc) 1451 1454 return -ENOMEM; 1452 1455 1453 - sz = le16_to_cpu(rsp->SecurityBufferOffset); 1454 - unsafe_memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, 1455 - spnego_blob_len, 1456 - /* alloc is larger than blob, see smb2_allocate_rsp_buf() */); 1456 + memcpy(rsp->Buffer, spnego_blob, spnego_blob_len); 1457 1457 rsp->SecurityBufferLength = cpu_to_le16(spnego_blob_len); 1458 1458 kfree(spnego_blob); 1459 1459 } ··· 2052 2058 * @access: file access flags 2053 2059 * @disposition: file disposition flags 2054 2060 * @may_flags: set with MAY_ flags 2055 - * @is_dir: is creating open flags for directory 2061 + * @coptions: file creation options 2062 + * @mode: file mode 2056 2063 * 2057 2064 * Return: file open flags 2058 2065 */ 2059 2066 static int smb2_create_open_flags(bool file_present, __le32 access, 2060 2067 __le32 disposition, 2061 2068 int *may_flags, 2062 - bool is_dir) 2069 + __le32 coptions, 2070 + umode_t mode) 2063 2071 { 2064 2072 int oflags = O_NONBLOCK | O_LARGEFILE; 2065 2073 2066 - if (is_dir) { 2074 + if (coptions & FILE_DIRECTORY_FILE_LE || S_ISDIR(mode)) { 2067 2075 access &= ~FILE_WRITE_DESIRE_ACCESS_LE; 2068 2076 ksmbd_debug(SMB, "Discard write access to a directory\n"); 2069 2077 } ··· 2082 2086 *may_flags = MAY_OPEN | MAY_READ; 2083 2087 } 2084 2088 2085 - if (access == FILE_READ_ATTRIBUTES_LE) 2089 + if (access == FILE_READ_ATTRIBUTES_LE || S_ISBLK(mode) || S_ISCHR(mode)) 2086 2090 oflags |= O_PATH; 2087 2091 2088 2092 if (file_present) { ··· 3177 3181 open_flags = smb2_create_open_flags(file_present, daccess, 3178 3182 req->CreateDisposition, 3179 3183 &may_flags, 3180 - req->CreateOptions & FILE_DIRECTORY_FILE_LE || 3181 - (file_present && S_ISDIR(d_inode(path.dentry)->i_mode))); 3184 + req->CreateOptions, 3185 + file_present ? d_inode(path.dentry)->i_mode : 0); 3182 3186 3183 3187 if (!test_tree_conn_flag(tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) { 3184 3188 if (open_flags & (O_CREAT | O_TRUNC)) { ··· 3527 3531 memcpy(fp->create_guid, dh_info.CreateGuid, 3528 3532 SMB2_CREATE_GUID_SIZE); 3529 3533 if (dh_info.timeout) 3530 - fp->durable_timeout = min(dh_info.timeout, 3531 - DURABLE_HANDLE_MAX_TIMEOUT); 3534 + fp->durable_timeout = 3535 + min_t(unsigned int, dh_info.timeout, 3536 + DURABLE_HANDLE_MAX_TIMEOUT); 3532 3537 else 3533 3538 fp->durable_timeout = 60; 3534 3539 } ··· 4583 4586 path = &fp->filp->f_path; 4584 4587 /* single EA entry is requested with given user.* name */ 4585 4588 if (req->InputBufferLength) { 4586 - if (le32_to_cpu(req->InputBufferLength) < 4589 + if (le32_to_cpu(req->InputBufferLength) <= 4587 4590 sizeof(struct smb2_ea_info_req)) 4588 4591 return -EINVAL; 4589 4592 ··· 8087 8090 goto out; 8088 8091 } 8089 8092 8090 - if (in_buf_len < sizeof(struct copychunk_ioctl_req)) { 8093 + if (in_buf_len <= sizeof(struct copychunk_ioctl_req)) { 8091 8094 ret = -EINVAL; 8092 8095 goto out; 8093 8096 }
+2 -2
fs/smb/server/smb2pdu.h
··· 194 194 __le64 ResumeKey[3]; 195 195 __le32 ChunkCount; 196 196 __le32 Reserved; 197 - __u8 Chunks[1]; /* array of srv_copychunk */ 197 + __u8 Chunks[]; /* array of srv_copychunk */ 198 198 } __packed; 199 199 200 200 struct srv_copychunk { ··· 370 370 struct smb2_ea_info_req { 371 371 __le32 NextEntryOffset; 372 372 __u8 EaNameLength; 373 - char name[1]; 373 + char name[]; 374 374 } __packed; /* level 15 Query */ 375 375 376 376 struct smb2_ea_info {
+1 -1
fs/smb/server/smb_common.c
··· 488 488 * @shortname: destination short filename 489 489 * 490 490 * Return: shortname length or 0 when source long name is '.' or '..' 491 - * TODO: Though this function comforms the restriction of 8.3 Filename spec, 491 + * TODO: Though this function conforms the restriction of 8.3 Filename spec, 492 492 * but the result is different with Windows 7's one. need to check. 493 493 */ 494 494 int ksmbd_extract_shortname(struct ksmbd_conn *conn, const char *longname,
+2 -2
fs/smb/server/vfs_cache.h
··· 100 100 struct list_head blocked_works; 101 101 struct list_head lock_list; 102 102 103 - int durable_timeout; 104 - int durable_scavenger_timeout; 103 + unsigned int durable_timeout; 104 + unsigned int durable_scavenger_timeout; 105 105 106 106 /* if ls is happening on directory, below is valid*/ 107 107 struct ksmbd_readdir_data readdir_data;
+1 -1
fs/smb/server/xattr.h
··· 99 99 __u8 posix_acl_hash[XATTR_SD_HASH_SIZE]; /* 64bytes hash for posix acl */ 100 100 }; 101 101 102 - /* DOS ATTRIBUITE XATTR PREFIX */ 102 + /* DOS ATTRIBUTE XATTR PREFIX */ 103 103 #define DOS_ATTRIBUTE_PREFIX "DOSATTRIB" 104 104 #define DOS_ATTRIBUTE_PREFIX_LEN (sizeof(DOS_ATTRIBUTE_PREFIX) - 1) 105 105 #define XATTR_NAME_DOS_ATTRIBUTE (XATTR_USER_PREFIX DOS_ATTRIBUTE_PREFIX)