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 Conklin <sconklin@canonical.com>
Thu, 2 Jun 2011 19:23:19 +0000 (14:23 -0500)
commitaff107bfdbf233669b43e3cc122f85703964cfcf
tree8aa1395740928dbddf602032a44b420c2732b722
parent16d92d9f2c1ad1bd36ac21b701f47ed411e1f0c5
cifs: check for bytes_remaining going to zero in CIFS_SessSetup

BugLink: http://bugs.launchpad.net/bugs/788691

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>
Signed-off-by: Steve Conklin <sconklin@canonical.com>
fs/cifs/sess.c