mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Can Guo <cang@codeaurora.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: scsi: ufs: Serialize eh_work with system PM events and async scan
Date: Tue, 15 Dec 2020 00:31:52 +0000	[thread overview]
Message-ID: <491799be-ea2e-5b60-b14b-bbdfd516d7ac@canonical.com> (raw)

Hi,

Static analysis on linux-next with Coverity had found a potential null
pointer dereference issue in the following commit:

commit 88a92d6ae4fe09b2b27781178c5c9432d27b1ffb
Author: Can Guo <cang@codeaurora.org>
Date:   Wed Dec 2 04:04:01 2020 -0800

    scsi: ufs: Serialize eh_work with system PM events and async scan

The analysis by Coverity is as follows:

8929 int ufshcd_system_suspend(struct ufs_hba *hba)
8930 {
8931        int ret = 0;
8932        ktime_t start = ktime_get();
8933
    deref_ptr_in_call: Dereferencing pointer hba.

8934        down(&hba->eh_sem);

    Dereference before null check (REVERSE_INULL)

check_after_deref: Null-checking hba suggests that it may be null, but
it has already been dereferenced on all paths leading to the check.

8935        if (!hba || !hba->is_powered)
8936                return 0;

Seeing that the down lock has been added by the commit it suggests the
commit overlooks the fact that hba may potentially be null. Not sure if
hba can be null, so I'm not sure if this is a real bug or a false positive.

Colin


                 reply	other threads:[~2020-12-15  0:34 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=491799be-ea2e-5b60-b14b-bbdfd516d7ac@canonical.com \
    --to=colin.king@canonical.com \
    --cc=cang@codeaurora.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®