cifs: check for bytes_remaining going to zero in CIFS_SessSetup
authorJeff Layton <jlayton@redhat.com>
Wed, 27 Apr 2011 17:25:51 +0000 (13:25 -0400)
committerSteve French <sfrench@us.ibm.com>
Fri, 29 Apr 2011 04:57:39 +0000 (04:57 +0000)
commitfcda7f4578bbf9717444ca6da8a421d21489d078
tree5cf2fc99c067eb49f410ad095ca2cabec2fe86ac
parentbfacf2225a955bea9c41c707fc72ba16009674a0
cifs: check for bytes_remaining going to zero in CIFS_SessSetup

It's possible that when we go to decode the string area in the
SESSION_SETUP response, that bytes_remaining will be 0. Decrementing it at
that point will mean that it can go "negative" and wrap. Check for a
bytes_remaining value of 0, and don't try to decode the string area if
that's the case.

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/sess.c