RHBZ: 
1021460
There is an issue where when multiple threads open/close the same directory
ntwrk_buf_start might end up being NULL, causing the call to smbCalcSize
later to oops with a NULL deref.
The real bug is why this happens and why this can become NULL for an
open cfile, which should not be allowed.
This patch tries to avoid a oops until the time when we fix the underlying
issue.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
                /* scan and find it */
                int i;
                char *cur_ent;
-               char *end_of_smb = cfile->srch_inf.ntwrk_buf_start +
+               char *end_of_smb;
+
+               if (cfile->srch_inf.ntwrk_buf_start == NULL) {
+                       cifs_dbg(VFS, "ntwrk_buf_start is NULL during readdir\n");
+                       return -EIO;
+               }
+
+               end_of_smb = cfile->srch_inf.ntwrk_buf_start +
                        server->ops->calc_smb_size(
                                        cfile->srch_inf.ntwrk_buf_start,
                                        server);