public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: coverity-bot <keescook@chromium.org>
To: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: Steve French <stfrench@microsoft.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Coverity: invalidate_all_cached_dirs(): Concurrent data access violations
Date: Thu, 13 Oct 2022 08:27:17 -0700	[thread overview]
Message-ID: <202210130827.48F03E2A39@keescook> (raw)

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 we

If 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):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1525256 ("Concurrent data access violations")
Fixes: a350d6e73f5e ("cifs: enable caching of directories for which a lease is held")

Thanks for your attention!

-- 
Coverity-bot

                 reply	other threads:[~2022-10-13 15:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202210130827.48F03E2A39@keescook \
    --to=keescook@chromium.org \
    --cc=gustavo@embeddedor.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=stfrench@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox