cifs: check for bytes_remaining going to zero in CIFS_SessSetup
commit0a26a86d85719e0085c25e303aa7a31ba9b47d75
authorJeff Layton <jlayton@redhat.com>
Wed, 27 Apr 2011 17:25:51 +0000 (27 13:25 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 23 May 2011 18:22:55 +0000 (23 11:22 -0700)
treeb3be8029eae5bf501b314e0113732c53faa7ce4c
parente607690a348b046f86f8c19d73a1edafe4b14bdc
cifs: check for bytes_remaining going to zero in CIFS_SessSetup

commit fcda7f4578bbf9717444ca6da8a421d21489d078 upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/sess.c