Skip to content

Commit 053569c

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: set rc to -ENOENT if we can not get a dentry for the cached dir
We already set rc to this return code further down in the function but we can set it earlier in order to suppress a smash warning. Also fix a false positive for Coverity. The reason this is a false positive is that this happens during umount after all files and directories have been closed but mosetting on ->on_list to suppress the warning. Reported-by: Dan carpenter <[email protected]> Reported-by: coverity-bot <[email protected]> Addresses-Coverity-ID: 1525256 ("Concurrent data access violations") Fixes: a350d6e ("cifs: enable caching of directories for which a lease is held") Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d32f211 commit 053569c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/cifs/cached_dir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
253253
dentry = dget(cifs_sb->root);
254254
else {
255255
dentry = path_to_dentry(cifs_sb, path);
256-
if (IS_ERR(dentry))
256+
if (IS_ERR(dentry)) {
257+
rc = -ENOENT;
257258
goto oshr_free;
259+
}
258260
}
259261
cfid->dentry = dentry;
260262
cfid->tcon = tcon;
@@ -385,13 +387,13 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon)
385387
list_move(&cfid->entry, &entry);
386388
cfids->num_entries--;
387389
cfid->is_open = false;
390+
cfid->on_list = false;
388391
/* To prevent race with smb2_cached_lease_break() */
389392
kref_get(&cfid->refcount);
390393
}
391394
spin_unlock(&cfids->cfid_list_lock);
392395

393396
list_for_each_entry_safe(cfid, q, &entry, entry) {
394-
cfid->on_list = false;
395397
list_del(&cfid->entry);
396398
cancel_work_sync(&cfid->lease_break);
397399
if (cfid->has_lease) {

0 commit comments

Comments
 (0)