diff options
-rw-r--r-- | fs/cifs/connect.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5eacb89d4a4f..709fd9d9b78f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -248,24 +248,24 @@ static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize) | |||
248 | total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); | 248 | total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); |
249 | data_in_this_rsp = get_unaligned_le16(&pSMBt->t2_rsp.DataCount); | 249 | data_in_this_rsp = get_unaligned_le16(&pSMBt->t2_rsp.DataCount); |
250 | 250 | ||
251 | remaining = total_data_size - data_in_this_rsp; | 251 | if (total_data_size == data_in_this_rsp) |
252 | |||
253 | if (remaining == 0) | ||
254 | return 0; | 252 | return 0; |
255 | else if (remaining < 0) { | 253 | else if (total_data_size < data_in_this_rsp) { |
256 | cFYI(1, "total data %d smaller than data in frame %d", | 254 | cFYI(1, "total data %d smaller than data in frame %d", |
257 | total_data_size, data_in_this_rsp); | 255 | total_data_size, data_in_this_rsp); |
258 | return -EINVAL; | 256 | return -EINVAL; |
259 | } else { | ||
260 | cFYI(1, "missing %d bytes from transact2, check next response", | ||
261 | remaining); | ||
262 | if (total_data_size > maxBufSize) { | ||
263 | cERROR(1, "TotalDataSize %d is over maximum buffer %d", | ||
264 | total_data_size, maxBufSize); | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | return remaining; | ||
268 | } | 257 | } |
258 | |||
259 | remaining = total_data_size - data_in_this_rsp; | ||
260 | |||
261 | cFYI(1, "missing %d bytes from transact2, check next response", | ||
262 | remaining); | ||
263 | if (total_data_size > maxBufSize) { | ||
264 | cERROR(1, "TotalDataSize %d is over maximum buffer %d", | ||
265 | total_data_size, maxBufSize); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | return remaining; | ||
269 | } | 269 | } |
270 | 270 | ||
271 | static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | 271 | static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) |