stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Xue, Ken" <Ken.Xue@amd.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mlin@kernel.org" <mlin@kernel.org>,
	"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"Huang, Shane" <Shane.Huang@amd.com>,
	SPG_Linux_Kernel <SPG_Linux_Kernel@amd.com>,
	"aaron.lu@intel.com" <aaron.lu@intel.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"JBottomley@Odin.com" <JBottomley@Odin.com>,
	"Yu, Xiangliang" <Xiangliang.Yu@amd.com>
Subject: Re: [PATCH 1/2]Revert "SCSI: Fix NULL pointer dereference in runtime PM"
Date: Fri, 27 Nov 2015 03:01:42 +0000	[thread overview]
Message-ID: <1448593294.3216.11.camel@amd.com> (raw)
In-Reply-To: <1441851826.5845.105.camel@kxue-X58A-UD3R>

On 四, 2015-09-10 at 10:23 +0800, Ken Xue wrote:

Can someone help to apply this patch series? Thanks.
http://marc.info/?l=linux-scsi&m=144185206825609&w=2
http://marc.info/?l=linux-scsi&m=144185208525611&w=2 

> Revert "SCSI: Fix NULL pointer dereference in runtime PM"
> 
> This reverts commit 49718f0fb8c9 ("SCSI: Fix NULL pointer dereference
> in
> runtime PM")
> 
> The old commit may lead to a issue that
> blk_{pre|post}_runtime_suspend and
> blk_{pre|post}_runtime_resume can not be called in pairs.
> 
> Take sr device as example, when sr device goes to runtime suspend, 
> blk_{pre|post}_runtime_suspend will be called since sr device defined
> pm->runtime_suspend. But blk_{pre|post}_runtime_resume will not be
> called
> since sr device doesn't have pm->runtime_resume. Then sr device can
> not
> resume correctly anymore.
> 
> Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> Cc: stable@vger.kernel.org
> 
> ---
>  drivers/scsi/scsi_pm.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index e4b7998..459abe1 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -219,13 +219,13 @@ static int sdev_runtime_suspend(struct device
> *dev)
>  	struct scsi_device *sdev = to_scsi_device(dev);
>  	int err = 0;
>  
> -	if (pm && pm->runtime_suspend) {
> -		err = blk_pre_runtime_suspend(sdev->request_queue);
> -		if (err)
> -			return err;
> +	err = blk_pre_runtime_suspend(sdev->request_queue);
> +	if (err)
> +		return err;
> +	if (pm && pm->runtime_suspend)
>  		err = pm->runtime_suspend(dev);
> -		blk_post_runtime_suspend(sdev->request_queue, err);
> -	}
> +	blk_post_runtime_suspend(sdev->request_queue, err);
> +
>  	return err;
>  }
>  
> @@ -248,11 +248,11 @@ static int sdev_runtime_resume(struct device
> *dev)
>  	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm
> : NULL;
>  	int err = 0;
>  
> -	if (pm && pm->runtime_resume) {
> -		blk_pre_runtime_resume(sdev->request_queue);
> +	blk_pre_runtime_resume(sdev->request_queue);
> +	if (pm && pm->runtime_resume)
>  		err = pm->runtime_resume(dev);
> -		blk_post_runtime_resume(sdev->request_queue, err);
> -	}
> +	blk_post_runtime_resume(sdev->request_queue, err);
> +
>  	return err;
>  }
>  

  reply	other threads:[~2015-11-27  3:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1441782131.5845.73.camel@kxue-X58A-UD3R>
2015-09-10  2:23 ` [PATCH 1/2]Revert "SCSI: Fix NULL pointer dereference in runtime PM" Ken Xue
2015-11-27  3:01   ` Xue, Ken [this message]
2015-12-01  6:45 Ken Xue

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=1448593294.3216.11.camel@amd.com \
    --to=ken.xue@amd.com \
    --cc=JBottomley@Odin.com \
    --cc=SPG_Linux_Kernel@amd.com \
    --cc=Shane.Huang@amd.com \
    --cc=Xiangliang.Yu@amd.com \
    --cc=aaron.lu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mlin@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).