diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-06 09:30:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-06 09:30:21 -0400 |
commit | 3c68319b28474055481824032e6730c28404116f (patch) | |
tree | 81986a1e9ab1f0bdd8fe1563f03a666b5b5ff097 | |
parent | 049e6dde7e57f0054fdc49102e7ef4830c698b46 (diff) | |
parent | 616a5399b8f11a526cedcbaeb68bc0a1b08a3f43 (diff) |
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French:
"Two fixes for problems pointed out by automated tools.
Thanks PaX/grsecurity team and Dan Carpenter (and the Smatch tool)"
* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
[CIFS] Update cifs version number
[SMB3] Do not fall back to SMBWriteX in set_file_size error cases
[SMB3] Missing null tcon check
-rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
-rw-r--r-- | fs/cifs/inode.c | 34 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.c | 2 |
3 files changed, 2 insertions, 36 deletions
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 27aea110e923..c3cc1609025f 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -136,5 +136,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
136 | extern const struct export_operations cifs_export_ops; | 136 | extern const struct export_operations cifs_export_ops; |
137 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 137 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
138 | 138 | ||
139 | #define CIFS_VERSION "2.07" | 139 | #define CIFS_VERSION "2.08" |
140 | #endif /* _CIFSFS_H */ | 140 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index f621b44cb800..6b66dd5d1540 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -2034,7 +2034,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, | |||
2034 | struct tcon_link *tlink = NULL; | 2034 | struct tcon_link *tlink = NULL; |
2035 | struct cifs_tcon *tcon = NULL; | 2035 | struct cifs_tcon *tcon = NULL; |
2036 | struct TCP_Server_Info *server; | 2036 | struct TCP_Server_Info *server; |
2037 | struct cifs_io_parms io_parms; | ||
2038 | 2037 | ||
2039 | /* | 2038 | /* |
2040 | * To avoid spurious oplock breaks from server, in the case of | 2039 | * To avoid spurious oplock breaks from server, in the case of |
@@ -2056,18 +2055,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, | |||
2056 | rc = -ENOSYS; | 2055 | rc = -ENOSYS; |
2057 | cifsFileInfo_put(open_file); | 2056 | cifsFileInfo_put(open_file); |
2058 | cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc); | 2057 | cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc); |
2059 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | ||
2060 | unsigned int bytes_written; | ||
2061 | |||
2062 | io_parms.netfid = open_file->fid.netfid; | ||
2063 | io_parms.pid = open_file->pid; | ||
2064 | io_parms.tcon = tcon; | ||
2065 | io_parms.offset = 0; | ||
2066 | io_parms.length = attrs->ia_size; | ||
2067 | rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, | ||
2068 | NULL, NULL, 1); | ||
2069 | cifs_dbg(FYI, "Wrt seteof rc %d\n", rc); | ||
2070 | } | ||
2071 | } else | 2058 | } else |
2072 | rc = -EINVAL; | 2059 | rc = -EINVAL; |
2073 | 2060 | ||
@@ -2093,28 +2080,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, | |||
2093 | else | 2080 | else |
2094 | rc = -ENOSYS; | 2081 | rc = -ENOSYS; |
2095 | cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc); | 2082 | cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc); |
2096 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | ||
2097 | __u16 netfid; | ||
2098 | int oplock = 0; | ||
2099 | 2083 | ||
2100 | rc = SMBLegacyOpen(xid, tcon, full_path, FILE_OPEN, | ||
2101 | GENERIC_WRITE, CREATE_NOT_DIR, &netfid, | ||
2102 | &oplock, NULL, cifs_sb->local_nls, | ||
2103 | cifs_remap(cifs_sb)); | ||
2104 | if (rc == 0) { | ||
2105 | unsigned int bytes_written; | ||
2106 | |||
2107 | io_parms.netfid = netfid; | ||
2108 | io_parms.pid = current->tgid; | ||
2109 | io_parms.tcon = tcon; | ||
2110 | io_parms.offset = 0; | ||
2111 | io_parms.length = attrs->ia_size; | ||
2112 | rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, NULL, | ||
2113 | NULL, 1); | ||
2114 | cifs_dbg(FYI, "wrt seteof rc %d\n", rc); | ||
2115 | CIFSSMBClose(xid, tcon, netfid); | ||
2116 | } | ||
2117 | } | ||
2118 | if (tlink) | 2084 | if (tlink) |
2119 | cifs_put_tlink(tlink); | 2085 | cifs_put_tlink(tlink); |
2120 | 2086 | ||
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index ce83e2edbe0a..597a417ba94d 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -922,7 +922,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, | |||
922 | if (tcon && tcon->bad_network_name) | 922 | if (tcon && tcon->bad_network_name) |
923 | return -ENOENT; | 923 | return -ENOENT; |
924 | 924 | ||
925 | if ((tcon->seal) && | 925 | if ((tcon && tcon->seal) && |
926 | ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) { | 926 | ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) { |
927 | cifs_dbg(VFS, "encryption requested but no server support"); | 927 | cifs_dbg(VFS, "encryption requested but no server support"); |
928 | return -EOPNOTSUPP; | 928 | return -EOPNOTSUPP; |