Coverity: invalidate_all_cached_dirs(): Concurrent data access violations
Hello!
This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20221013 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:
Wed Oct 12 16:54:23 2022 -0500
a350d6e73f5e ("cifs: enable caching of directories for which a lease is held")
Coverity reported the following:
*** CID 1525256: Concurrent data access violations (MISSING_LOCK) /fs/cifs/cached_dir.c: 396 in invalidate_all_cached_dirs()
390 /* To prevent race with smb2_cached_lease_break() */
391 kref_get(&cfid->refcount);
392 }
393 spin_unlock(&cfids->cfid_list_lock);
394
395 list_for_each_entry_safe(cfid, q, &entry, entry) {
vvv CID 1525256: Concurrent data access violations (MISSING_LOCK)
vvv Accessing "cfid->on_list" without holding lock "cached_fids.cfid_list_lock". Elsewhere, "cached_fid.on_list" is accessed with "cached_fids.cfid_list_lock" held 5 out of 6 times.
396 cfid->on_list = false;
397 list_del(&cfid->entry);
398 cancel_work_sync(&cfid->lease_break);
399 if (cfid->has_lease) {
400 /*
401 * We lease was never cancelled from the server so weIf this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):
Addresses-Coverity-ID: 1525256 ("Concurrent data access violations")
Thanks for your attention!
Signature · 1 line
Coverity-bot