linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Bean Huo <huobean@gmail.com>
Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org,
	hongwus@codeaurora.org, rnayak@codeaurora.org,
	linux-scsi@vger.kernel.org, kernel-team@android.com,
	saravanak@google.com, salyzyn@google.com,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>,
	Bart Van Assche <bvanassche@acm.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 1/1] scsi: ufs: Fix a possible NULL pointer issue
Date: Fri, 18 Dec 2020 13:42:35 +0800	[thread overview]
Message-ID: <44d4f6349b7c8d806871acbe22c2bcce@codeaurora.org> (raw)
In-Reply-To: <7eb8f335f4eb85385f54c88952f7749750340320.camel@gmail.com>

On 2020-12-14 22:32, Bean Huo wrote:
> On Sun, 2020-12-13 at 19:41 -0800, Can Guo wrote:
>> Fixes: 88a92d6ae4fe ("scsi: ufs: Serialize eh_work with system PM
>> events and async scan")
>> 
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
>>  drivers/scsi/ufs/ufshcd.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index c1c401b..ef155a9 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -8883,8 +8883,11 @@ int ufshcd_system_suspend(struct ufs_hba *hba)
>>         int ret = 0;
>>         ktime_t start = ktime_get();
>> 
>> +       if (!hba)
>> +               return 0;
>> +
>>         down(&hba->eh_sem);
>> -       if (!hba || !hba->is_powered)
>> +       if (!hba->is_powered)
>>                 return 0;
> 
> 
> Can,
> 
> why not moving down(&hba->eh_sem) after "return 0;"?

In your way, if hba is not powered, ufshcd_system_suspend() returns
0, which is a successful suspend. When ufshcd_system_resume() is called,
if hba is not powered, it goes to out and does up(&hba->eh_sem), which
shall cause unbalance to eh_sem.

Thanks,

Can Guo.

      reply	other threads:[~2020-12-18  5:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  3:41 [PATCH V2 1/1] scsi: ufs: Fix a possible NULL pointer issue Can Guo
2020-12-14 14:32 ` Bean Huo
2020-12-18  5:42   ` Can Guo [this message]

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=44d4f6349b7c8d806871acbe22c2bcce@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=hongwus@codeaurora.org \
    --cc=huobean@gmail.com \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nguyenb@codeaurora.org \
    --cc=rnayak@codeaurora.org \
    --cc=salyzyn@google.com \
    --cc=saravanak@google.com \
    --cc=stanley.chu@mediatek.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;
as well as URLs for NNTP newsgroup(s).