diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-01-01 10:34:39 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-01-03 20:34:17 -0600 |
commit | 497728e11a9deeaea18be19fadcf7f1c85efbcf7 (patch) | |
tree | 426b57623483588f7bdc15dc01cbd0930949fac1 /fs/cifs | |
parent | f9fab10bbd768b0e5254e53a4a8477a94bfc4b96 (diff) | |
download | linux-3.10-497728e11a9deeaea18be19fadcf7f1c85efbcf7.tar.gz linux-3.10-497728e11a9deeaea18be19fadcf7f1c85efbcf7.tar.bz2 linux-3.10-497728e11a9deeaea18be19fadcf7f1c85efbcf7.zip |
cifs: fix bad buffer length check in coalesce_t2
The current check looks to see if the RFC1002 length is larger than
CIFSMaxBufSize, and fails if it is. The buffer is actually larger than
that by MAX_CIFS_HDR_SIZE.
This bug has been around for a long time, but the fact that we used to
cap the clients MaxBufferSize at the same level as the server tended
to paper over it. Commit c974befa changed that however and caused this
bug to bite in more cases.
Reported-and-Tested-by: Konstantinos Skarlatos <k.skarlatos@gmail.com>
Tested-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8cd4b52d421..27c4f255171 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -282,7 +282,7 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) byte_count = be32_to_cpu(pTargetSMB->smb_buf_length); byte_count += total_in_buf2; /* don't allow buffer to overflow */ - if (byte_count > CIFSMaxBufSize) + if (byte_count > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) return -ENOBUFS; pTargetSMB->smb_buf_length = cpu_to_be32(byte_count); |