diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-07 21:31:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-07 21:31:34 -0400 |
commit | b2d44d145d2a72386b1b17da59a5e04989594897 (patch) | |
tree | e6e8742ca479c8ab8eba123f7990dbb8d2166012 /fs/cifs/smb2ops.c | |
parent | 4f572efde4600a577d1fc0bcee191bc9cec842f8 (diff) | |
parent | 729c0c9dd55204f0c9a823ac8a7bfa83d36c7e78 (diff) |
Merge tag '4.18-rc3-smb3fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French:
"Five smb3/cifs fixes for stable (including for some leaks and memory
overwrites) and also a few fixes for recent regressions in packet
signing.
Additional testing at the recent SMB3 test event, and some good work
by Paulo and others spotted the issues fixed here. In addition to my
xfstest runs on these, Aurelien and Stefano did additional test runs
to verify this set"
* tag '4.18-rc3-smb3fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: Fix stack out-of-bounds in smb{2,3}_create_lease_buf()
cifs: Fix infinite loop when using hard mount option
cifs: Fix slab-out-of-bounds in send_set_info() on SMB2 ACE setting
cifs: Fix memory leak in smb2_set_ea()
cifs: fix SMB1 breakage
cifs: Fix validation of signed data in smb2
cifs: Fix validation of signed data in smb3+
cifs: Fix use after free of a mid_q_entry
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 0356b5559c71..ea92a38b2f08 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -203,6 +203,7 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf) | |||
203 | if ((mid->mid == wire_mid) && | 203 | if ((mid->mid == wire_mid) && |
204 | (mid->mid_state == MID_REQUEST_SUBMITTED) && | 204 | (mid->mid_state == MID_REQUEST_SUBMITTED) && |
205 | (mid->command == shdr->Command)) { | 205 | (mid->command == shdr->Command)) { |
206 | kref_get(&mid->refcount); | ||
206 | spin_unlock(&GlobalMid_Lock); | 207 | spin_unlock(&GlobalMid_Lock); |
207 | return mid; | 208 | return mid; |
208 | } | 209 | } |
@@ -855,6 +856,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, | |||
855 | 856 | ||
856 | rc = SMB2_set_ea(xid, tcon, fid.persistent_fid, fid.volatile_fid, ea, | 857 | rc = SMB2_set_ea(xid, tcon, fid.persistent_fid, fid.volatile_fid, ea, |
857 | len); | 858 | len); |
859 | kfree(ea); | ||
860 | |||
858 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | 861 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); |
859 | 862 | ||
860 | return rc; | 863 | return rc; |
@@ -2219,8 +2222,7 @@ smb2_create_lease_buf(u8 *lease_key, u8 oplock) | |||
2219 | if (!buf) | 2222 | if (!buf) |
2220 | return NULL; | 2223 | return NULL; |
2221 | 2224 | ||
2222 | buf->lcontext.LeaseKeyLow = cpu_to_le64(*((u64 *)lease_key)); | 2225 | memcpy(&buf->lcontext.LeaseKey, lease_key, SMB2_LEASE_KEY_SIZE); |
2223 | buf->lcontext.LeaseKeyHigh = cpu_to_le64(*((u64 *)(lease_key + 8))); | ||
2224 | buf->lcontext.LeaseState = map_oplock_to_lease(oplock); | 2226 | buf->lcontext.LeaseState = map_oplock_to_lease(oplock); |
2225 | 2227 | ||
2226 | buf->ccontext.DataOffset = cpu_to_le16(offsetof | 2228 | buf->ccontext.DataOffset = cpu_to_le16(offsetof |
@@ -2246,8 +2248,7 @@ smb3_create_lease_buf(u8 *lease_key, u8 oplock) | |||
2246 | if (!buf) | 2248 | if (!buf) |
2247 | return NULL; | 2249 | return NULL; |
2248 | 2250 | ||
2249 | buf->lcontext.LeaseKeyLow = cpu_to_le64(*((u64 *)lease_key)); | 2251 | memcpy(&buf->lcontext.LeaseKey, lease_key, SMB2_LEASE_KEY_SIZE); |
2250 | buf->lcontext.LeaseKeyHigh = cpu_to_le64(*((u64 *)(lease_key + 8))); | ||
2251 | buf->lcontext.LeaseState = map_oplock_to_lease(oplock); | 2252 | buf->lcontext.LeaseState = map_oplock_to_lease(oplock); |
2252 | 2253 | ||
2253 | buf->ccontext.DataOffset = cpu_to_le16(offsetof | 2254 | buf->ccontext.DataOffset = cpu_to_le16(offsetof |
@@ -2284,8 +2285,7 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key) | |||
2284 | if (lc->lcontext.LeaseFlags & SMB2_LEASE_FLAG_BREAK_IN_PROGRESS) | 2285 | if (lc->lcontext.LeaseFlags & SMB2_LEASE_FLAG_BREAK_IN_PROGRESS) |
2285 | return SMB2_OPLOCK_LEVEL_NOCHANGE; | 2286 | return SMB2_OPLOCK_LEVEL_NOCHANGE; |
2286 | if (lease_key) | 2287 | if (lease_key) |
2287 | memcpy(lease_key, &lc->lcontext.LeaseKeyLow, | 2288 | memcpy(lease_key, &lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE); |
2288 | SMB2_LEASE_KEY_SIZE); | ||
2289 | return le32_to_cpu(lc->lcontext.LeaseState); | 2289 | return le32_to_cpu(lc->lcontext.LeaseState); |
2290 | } | 2290 | } |
2291 | 2291 | ||
@@ -2521,7 +2521,7 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, struct smb_rqst *new_rq, | |||
2521 | if (!tr_hdr) | 2521 | if (!tr_hdr) |
2522 | goto err_free_iov; | 2522 | goto err_free_iov; |
2523 | 2523 | ||
2524 | orig_len = smb2_rqst_len(old_rq, false); | 2524 | orig_len = smb_rqst_len(server, old_rq); |
2525 | 2525 | ||
2526 | /* fill the 2nd iov with a transform header */ | 2526 | /* fill the 2nd iov with a transform header */ |
2527 | fill_transform_hdr(tr_hdr, orig_len, old_rq); | 2527 | fill_transform_hdr(tr_hdr, orig_len, old_rq); |