]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: check for NULL last_entry before calling cifs_save_resume_key
authorJeff Layton <jlayton@redhat.com>
Fri, 2 Dec 2011 01:23:34 +0000 (20:23 -0500)
committerSteve French <smfrench@gmail.com>
Fri, 9 Dec 2011 04:04:47 +0000 (22:04 -0600)
commit0371a3a1cdad12108ce16ba8795c3d60c8bfea39
tree6aac4d2bbaae57306fa320beb4282c380171a8e2
parent2945d93017941f8591f4ac9e8b57f07cdb8a6ba5
cifs: check for NULL last_entry before calling cifs_save_resume_key

Prior to commit fa50cf2, cifs_save_resume_key had some NULL pointer
checks at the top. It turns out that at least one of those NULL
pointer checks is needed after all.

When the LastNameOffset in a FIND reply appears to be beyond the end of
the buffer, CIFSFindFirst and CIFSFindNext will set srch_inf.last_entry
to NULL. Since fa50cf2, the code will now oops in this situation.

Fix this by having the callers check for a NULL last entry pointer
before calling cifs_save_resume_key. No change is needed for the
call site in cifs_readdir as it's not reachable with a NULL
current_entry pointer.

This should fix:

    https://bugzilla.redhat.com/show_bug.cgi?id=750247

Cc: stable@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Reported-by: Adam G. Metzler <adamgmetzler@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/readdir.c