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 '5.16-rc2-ksmbd-fixes' of git://git.samba.org/ksmbd

Pull ksmbd fixes from Steve French:
"Five ksmbd server fixes, four of them for stable:

- memleak fix

- fix for default data stream on filesystems that don't support xattr

- error logging fix

- session setup fix

- minor doc cleanup"

* tag '5.16-rc2-ksmbd-fixes' of git://git.samba.org/ksmbd:
ksmbd: fix memleak in get_file_stream_info()
ksmbd: contain default data stream even if xattr is empty
ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec()
docs: filesystem: cifs: ksmbd: Fix small layout issues
ksmbd: Fix an error handling path in 'smb2_sess_setup()'

+22 -18
+5 -5
Documentation/filesystems/cifs/ksmbd.rst
··· 50 50 -------------------------------- 51 51 52 52 ksmbd.mountd is userspace process to, transfer user account and password that 53 - are registered using ksmbd.adduser(part of utils for user space). Further it 53 + are registered using ksmbd.adduser (part of utils for user space). Further it 54 54 allows sharing information parameters that parsed from smb.conf to ksmbd in 55 55 kernel. For the execution part it has a daemon which is continuously running 56 56 and connected to the kernel interface using netlink socket, it waits for the 57 - requests(dcerpc and share/user info). It handles RPC calls (at a minimum few 57 + requests (dcerpc and share/user info). It handles RPC calls (at a minimum few 58 58 dozen) that are most important for file server from NetShareEnum and 59 59 NetServerGetInfo. Complete DCE/RPC response is prepared from the user space 60 60 and passed over to the associated kernel thread for the client. ··· 154 154 1. Enable all component prints 155 155 # sudo ksmbd.control -d "all" 156 156 157 - 2. Enable one of components(smb, auth, vfs, oplock, ipc, conn, rdma) 157 + 2. Enable one of components (smb, auth, vfs, oplock, ipc, conn, rdma) 158 158 # sudo ksmbd.control -d "smb" 159 159 160 - 3. Show what prints are enable. 161 - # cat/sys/class/ksmbd-control/debug 160 + 3. Show what prints are enabled. 161 + # cat /sys/class/ksmbd-control/debug 162 162 [smb] auth vfs oplock ipc conn [rdma] 163 163 164 164 4. Disable prints:
+17 -13
fs/ksmbd/smb2pdu.c
··· 1697 1697 negblob_off = le16_to_cpu(req->SecurityBufferOffset); 1698 1698 negblob_len = le16_to_cpu(req->SecurityBufferLength); 1699 1699 if (negblob_off < offsetof(struct smb2_sess_setup_req, Buffer) || 1700 - negblob_len < offsetof(struct negotiate_message, NegotiateFlags)) 1701 - return -EINVAL; 1700 + negblob_len < offsetof(struct negotiate_message, NegotiateFlags)) { 1701 + rc = -EINVAL; 1702 + goto out_err; 1703 + } 1702 1704 1703 1705 negblob = (struct negotiate_message *)((char *)&req->hdr.ProtocolId + 1704 1706 negblob_off); ··· 4459 4457 &stat); 4460 4458 file_info = (struct smb2_file_stream_info *)rsp->Buffer; 4461 4459 4460 + buf_free_len = 4461 + smb2_calc_max_out_buf_len(work, 8, 4462 + le32_to_cpu(req->OutputBufferLength)); 4463 + if (buf_free_len < 0) 4464 + goto out; 4465 + 4462 4466 xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list); 4463 4467 if (xattr_list_len < 0) { 4464 4468 goto out; ··· 4472 4464 ksmbd_debug(SMB, "empty xattr in the file\n"); 4473 4465 goto out; 4474 4466 } 4475 - 4476 - buf_free_len = 4477 - smb2_calc_max_out_buf_len(work, 8, 4478 - le32_to_cpu(req->OutputBufferLength)); 4479 - if (buf_free_len < 0) 4480 - goto out; 4481 4467 4482 4468 while (idx < xattr_list_len) { 4483 4469 stream_name = xattr_list + idx; ··· 4498 4496 ":%s", &stream_name[XATTR_NAME_STREAM_LEN]); 4499 4497 4500 4498 next = sizeof(struct smb2_file_stream_info) + streamlen * 2; 4501 - if (next > buf_free_len) 4499 + if (next > buf_free_len) { 4500 + kfree(stream_buf); 4502 4501 break; 4502 + } 4503 4503 4504 4504 file_info = (struct smb2_file_stream_info *)&rsp->Buffer[nbytes]; 4505 4505 streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName, ··· 4518 4514 file_info->NextEntryOffset = cpu_to_le32(next); 4519 4515 } 4520 4516 4517 + out: 4521 4518 if (!S_ISDIR(stat.mode) && 4522 4519 buf_free_len >= sizeof(struct smb2_file_stream_info) + 7 * 2) { 4523 4520 file_info = (struct smb2_file_stream_info *) ··· 4527 4522 "::$DATA", 7, conn->local_nls, 0); 4528 4523 streamlen *= 2; 4529 4524 file_info->StreamNameLength = cpu_to_le32(streamlen); 4530 - file_info->StreamSize = 0; 4531 - file_info->StreamAllocationSize = 0; 4525 + file_info->StreamSize = cpu_to_le64(stat.size); 4526 + file_info->StreamAllocationSize = cpu_to_le64(stat.blocks << 9); 4532 4527 nbytes += sizeof(struct smb2_file_stream_info) + streamlen; 4533 4528 } 4534 4529 4535 4530 /* last entry offset should be 0 */ 4536 4531 file_info->NextEntryOffset = 0; 4537 - out: 4538 4532 kvfree(xattr_list); 4539 4533 4540 4534 rsp->OutputBufferLength = cpu_to_le32(nbytes); ··· 5072 5068 if (addition_info & ~(OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO | 5073 5069 PROTECTED_DACL_SECINFO | 5074 5070 UNPROTECTED_DACL_SECINFO)) { 5075 - pr_err("Unsupported addition info: 0x%x)\n", 5071 + ksmbd_debug(SMB, "Unsupported addition info: 0x%x)\n", 5076 5072 addition_info); 5077 5073 5078 5074 pntsd->revision = cpu_to_le16(1);