fs/smb/client/smb2inode.c
Source file repositories/reference/linux-study-clean/fs/smb/client/smb2inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/smb2inode.c- Extension
.c- Size
- 45861 bytes
- Lines
- 1565
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/stat.hlinux/slab.hlinux/pagemap.hasm/div64.hcifsfs.hcifsglob.hcifsproto.hcifs_debug.hcifs_fs_sb.hcifs_unicode.hfscache.hsmb2glob.hsmb2proto.hcached_dir.h../common/smb2status.h../common/smbfsctl.h
Detected Declarations
struct wsl_query_eafunction Copyrightfunction file_create_optionsfunction parse_posix_sidsfunction check_wsl_easfunction set_next_compoundfunction free_rsp_buffunction parse_create_responsefunction ea_unsupportedfunction free_rsp_iovfunction smb2_query_path_infofunction enoughfunction smb2_mkdirfunction smb2_compound_opfunction smb2_mkdir_setinfofunction smb2_rmdirfunction smb2_compound_opfunction smb2_unlinkfunction smb2_set_path_attrfunction smb2_rename_pathfunction clear_tmpfile_attrfunction smb2_create_hardlinkfunction smb2_set_path_sizefunction smb2_set_file_infofunction smb2_query_reparse_pointfunction smb2_rename_pending_delete
Annotated Snippet
struct wsl_query_ea {
__le32 next;
__u8 name_len;
__u8 name[SMB2_WSL_XATTR_NAME_LEN + 1];
} __packed;
#define NEXT_OFF cpu_to_le32(sizeof(struct wsl_query_ea))
static const struct wsl_query_ea wsl_query_eas[] = {
{ .next = NEXT_OFF, .name_len = SMB2_WSL_XATTR_NAME_LEN, .name = SMB2_WSL_XATTR_UID, },
{ .next = NEXT_OFF, .name_len = SMB2_WSL_XATTR_NAME_LEN, .name = SMB2_WSL_XATTR_GID, },
{ .next = NEXT_OFF, .name_len = SMB2_WSL_XATTR_NAME_LEN, .name = SMB2_WSL_XATTR_MODE, },
{ .next = 0, .name_len = SMB2_WSL_XATTR_NAME_LEN, .name = SMB2_WSL_XATTR_DEV, },
};
static int check_wsl_eas(struct kvec *rsp_iov)
{
struct smb2_file_full_ea_info *ea;
struct smb2_query_info_rsp *rsp = rsp_iov->iov_base;
unsigned long addr;
u32 outlen, next;
u16 vlen;
u8 nlen;
u8 *ea_end, *iov_end;
outlen = le32_to_cpu(rsp->OutputBufferLength);
if (outlen < SMB2_WSL_MIN_QUERY_EA_RESP_SIZE ||
outlen > SMB2_WSL_MAX_QUERY_EA_RESP_SIZE)
return -EINVAL;
ea = (void *)((u8 *)rsp_iov->iov_base +
le16_to_cpu(rsp->OutputBufferOffset));
ea_end = (u8 *)ea + outlen;
iov_end = (u8 *)rsp_iov->iov_base + rsp_iov->iov_len;
if (ea_end > iov_end)
return -EINVAL;
for (;;) {
if ((u8 *)ea > ea_end - sizeof(*ea))
return -EINVAL;
nlen = ea->ea_name_length;
vlen = le16_to_cpu(ea->ea_value_length);
if (nlen != SMB2_WSL_XATTR_NAME_LEN ||
(u8 *)ea->ea_data + nlen + 1 + vlen > ea_end)
return -EINVAL;
switch (vlen) {
case 4:
if (strncmp(ea->ea_data, SMB2_WSL_XATTR_UID, nlen) &&
strncmp(ea->ea_data, SMB2_WSL_XATTR_GID, nlen) &&
strncmp(ea->ea_data, SMB2_WSL_XATTR_MODE, nlen))
return -EINVAL;
break;
case 8:
if (strncmp(ea->ea_data, SMB2_WSL_XATTR_DEV, nlen))
return -EINVAL;
break;
case 0:
if (!strncmp(ea->ea_data, SMB2_WSL_XATTR_UID, nlen) ||
!strncmp(ea->ea_data, SMB2_WSL_XATTR_GID, nlen) ||
!strncmp(ea->ea_data, SMB2_WSL_XATTR_MODE, nlen) ||
!strncmp(ea->ea_data, SMB2_WSL_XATTR_DEV, nlen))
break;
fallthrough;
default:
return -EINVAL;
}
next = le32_to_cpu(ea->next_entry_offset);
if (!next)
break;
if (!IS_ALIGNED(next, 4) ||
check_add_overflow((unsigned long)ea, next, &addr))
return -EINVAL;
ea = (void *)addr;
}
return 0;
}
/*
* If @cfile is NULL, then need to account for trailing CLOSE request in the
* compound chain.
*/
static void set_next_compound(struct cifs_tcon *tcon,
struct cifsFileInfo *cfile,
int i, int num_cmds,
struct smb_rqst *rqst, int *num_rqst)
{
int k = !cfile ? 1 : 0;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/stat.h`, `linux/slab.h`, `linux/pagemap.h`, `asm/div64.h`, `cifsfs.h`, `cifsglob.h`, `cifsproto.h`.
- Detected declarations: `struct wsl_query_ea`, `function Copyright`, `function file_create_options`, `function parse_posix_sids`, `function check_wsl_eas`, `function set_next_compound`, `function free_rsp_buf`, `function parse_create_response`, `function ea_unsupported`, `function free_rsp_iov`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.