tree: git://git.samba.org/sfrench/cifs-2.6.git for-next head: 08bfa7f9e7f09e14001bc3ee23d143d935c39e93 commit: 08bfa7f9e7f09e14001bc3ee23d143d935c39e93 [14/14] smb3: fix mode on mkdir for smb311 posix extensions config: i386-randconfig-x012-201823 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: git checkout 08bfa7f9e7f09e14001bc3ee23d143d935c39e93 # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): fs//cifs/smb2pdu.c: In function 'smb311_posix_mkdir': >> fs//cifs/smb2pdu.c:2059:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ vim +2059 fs//cifs/smb2pdu.c 1913 1914 #ifdef CONFIG_CIFS_SMB311 1915 extern int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, 1916 umode_t mode, struct cifs_tcon *tcon, 1917 const char *full_path, 1918 struct cifs_sb_info *cifs_sb) 1919 { 1920 struct smb_rqst rqst; 1921 struct smb2_create_req *req; 1922 struct smb2_create_rsp *rsp; 1923 struct TCP_Server_Info *server; 1924 struct cifs_ses *ses = tcon->ses; 1925 struct kvec iov[4]; /* make sure at least one for each open context */ 1926 struct kvec rsp_iov = {NULL, 0}; 1927 int resp_buftype; 1928 int uni_path_len; 1929 __le16 *copy_path = NULL; 1930 int copy_size; 1931 int rc = 0; 1932 unsigned int n_iov = 2; 1933 __u32 file_attributes = 0; 1934 char *lc_buf = NULL, *pc_buf = NULL; 1935 int flags = 0; 1936 unsigned int total_len; 1937 __u8 oplock = 0; 1938 __le16 *path = cifs_convert_path_to_utf16(full_path, cifs_sb); 1939 1940 if (!path) 1941 return -ENOMEM; 1942 1943 cifs_dbg(FYI, "mkdir\n"); 1944 1945 if (ses && (ses->server)) 1946 server = ses->server; 1947 else 1948 return -EIO; 1949 1950 rc = smb2_plain_req_init(SMB2_CREATE, tcon, (void **) &req, &total_len); 1951 1952 if (rc) 1953 return rc; 1954 1955 if (smb3_encryption_required(tcon)) 1956 flags |= CIFS_TRANSFORM_REQ; 1957 1958 1959 req->ImpersonationLevel = IL_IMPERSONATION; 1960 req->DesiredAccess = cpu_to_le32(FILE_WRITE_ATTRIBUTES); 1961 /* File attributes ignored on open (used in create though) */ 1962 req->FileAttributes = cpu_to_le32(file_attributes); 1963 req->ShareAccess = FILE_SHARE_ALL_LE; 1964 req->CreateDisposition = cpu_to_le32(FILE_CREATE); 1965 req->CreateOptions = cpu_to_le32(CREATE_NOT_FILE); 1966 1967 iov[0].iov_base = (char *)req; 1968 /* -1 since last byte is buf[0] which is sent below (path) */ 1969 iov[0].iov_len = total_len - 1; 1970 1971 req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req)); 1972 1973 /* [MS-SMB2] 2.2.13 NameOffset: 1974 * If SMB2_FLAGS_DFS_OPERATIONS is set in the Flags field of 1975 * the SMB2 header, the file name includes a prefix that will 1976 * be processed during DFS name normalization as specified in 1977 * section 3.3.5.9. Otherwise, the file name is relative to 1978 * the share that is identified by the TreeId in the SMB2 1979 * header. 1980 */ 1981 if (tcon->share_flags & SHI1005_FLAGS_DFS) { 1982 int name_len; 1983 1984 req->sync_hdr.Flags |= SMB2_FLAGS_DFS_OPERATIONS; 1985 rc = alloc_path_with_tree_prefix(©_path, ©_size, 1986 &name_len, 1987 tcon->treeName, path); 1988 if (rc) { 1989 cifs_small_buf_release(req); 1990 return rc; 1991 } 1992 req->NameLength = cpu_to_le16(name_len * 2); 1993 uni_path_len = copy_size; 1994 path = copy_path; 1995 } else { 1996 uni_path_len = (2 * UniStrnlen((wchar_t *)path, PATH_MAX)) + 2; 1997 /* MUST set path len (NameLength) to 0 opening root of share */ 1998 req->NameLength = cpu_to_le16(uni_path_len - 2); 1999 if (uni_path_len % 8 != 0) { 2000 copy_size = roundup(uni_path_len, 8); 2001 copy_path = kzalloc(copy_size, GFP_KERNEL); 2002 if (!copy_path) { 2003 cifs_small_buf_release(req); 2004 return -ENOMEM; 2005 } 2006 memcpy((char *)copy_path, (const char *)path, 2007 uni_path_len); 2008 uni_path_len = copy_size; 2009 path = copy_path; 2010 } 2011 } 2012 2013 iov[1].iov_len = uni_path_len; 2014 iov[1].iov_base = path; 2015 2016 if (!server->oplocks) 2017 oplock = SMB2_OPLOCK_LEVEL_NONE; 2018 2019 if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) || 2020 oplock == SMB2_OPLOCK_LEVEL_NONE) 2021 req->RequestedOplockLevel = oplock; 2022 else { 2023 rc = add_lease_context(server, iov, &n_iov, &oplock); 2024 if (rc) { 2025 cifs_small_buf_release(req); 2026 kfree(copy_path); 2027 return rc; 2028 } 2029 lc_buf = iov[n_iov-1].iov_base; 2030 } 2031 2032 if (tcon->posix_extensions) { 2033 if (n_iov > 2) { 2034 struct create_context *ccontext = 2035 (struct create_context *)iov[n_iov-1].iov_base; 2036 ccontext->Next = 2037 cpu_to_le32(iov[n_iov-1].iov_len); 2038 } 2039 2040 rc = add_posix_context(iov, &n_iov, mode); 2041 if (rc) { 2042 cifs_small_buf_release(req); 2043 kfree(copy_path); 2044 kfree(lc_buf); 2045 return rc; 2046 } 2047 pc_buf = iov[n_iov-1].iov_base; 2048 } 2049 2050 2051 memset(&rqst, 0, sizeof(struct smb_rqst)); 2052 rqst.rq_iov = iov; 2053 rqst.rq_nvec = n_iov; 2054 2055 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, 2056 &rsp_iov); 2057 cifs_small_buf_release(req); 2058 rsp = (struct smb2_create_rsp *)rsp_iov.iov_base; > 2059 } 2060 #endif /* SMB311 */ 2061 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip