From 6b8ae753d684cddb9f6fd0e53000790b0ba3b0b6 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 1 Dec 2011 20:23:34 -0500 Subject: [PATCH] --- yaml --- r: 276605 b: refs/heads/master c: 7023676f9ee851d94f0942e879243fc1f9081c47 h: refs/heads/master i: 276603: 24a9909784145de787c68ddca1508f68728f5850 v: v3 --- [refs] | 2 +- trunk/fs/cifs/readdir.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 9d9641cfae05..607f1af4ec2c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 95edcff497b126a3f3e079e94b20fe2ca7e5a63d +refs/heads/master: 7023676f9ee851d94f0942e879243fc1f9081c47 diff --git a/trunk/fs/cifs/readdir.c b/trunk/fs/cifs/readdir.c index 5de03ec20144..a090bbe6ee29 100644 --- a/trunk/fs/cifs/readdir.c +++ b/trunk/fs/cifs/readdir.c @@ -554,7 +554,10 @@ static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon, rc); return rc; } - cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); + /* FindFirst/Next set last_entry to NULL on malformed reply */ + if (cifsFile->srch_inf.last_entry) + cifs_save_resume_key(cifsFile->srch_inf.last_entry, + cifsFile); } while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && @@ -562,7 +565,10 @@ static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon, cFYI(1, "calling findnext2"); rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, &cifsFile->srch_inf); - cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); + /* FindFirst/Next set last_entry to NULL on malformed reply */ + if (cifsFile->srch_inf.last_entry) + cifs_save_resume_key(cifsFile->srch_inf.last_entry, + cifsFile); if (rc) return -ENOENT; }