]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: sanitize length checking in coalesce_t2 (try #3)
authorJeff Layton <jlayton@redhat.com>
Wed, 27 Apr 2011 17:29:49 +0000 (13:29 -0400)
committerSteve French <sfrench@us.ibm.com>
Fri, 29 Apr 2011 05:02:08 +0000 (05:02 +0000)
commitcdc8dc1f14f3b3783fe404d8d6c650c38bfc40f7
treefb085ee1125e6f754c817df84cc603e56d664c52
parent68d53af5b7dcd1041c5b774a9a02f0cca85fdbc2
cifs: sanitize length checking in coalesce_t2 (try #3)

There are a couple of places in this code where these values can wrap or
go negative, and that could potentially end up overflowing the buffer.
Ensure that that doesn't happen. Do all of the length calculation and
checks first, and only perform the memcpy after they pass.

Also, increase some stack variables to 32 bits to ensure that they don't
wrap without being detected.

Finally, change the error codes to be a bit more descriptive of any
problems detected. -EINVAL isn't very accurate.

Cc: stable@kernel.org
Reported-and-Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/connect.c