From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
Akinobu Mita <mita@fixstars.com>,
Vinayak Holikatti <vinholikatti@gmail.com>,
Subhash Jadavani <subhashj@codeaurora.org>,
Dolev Raviv <draviv@codeaurora.org>,
Sujit Reddy Thumma <sthumma@codeaurora.org>,
Yaniv Gardi <ygardi@codeaurora.org>,
Christoph Hellwig <hch@lst.de>,
"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: [PATCH 2/2] scsi: ufs: fix NULL dereference when no regulators are defined
Date: Tue, 18 Nov 2014 23:02:46 +0900 [thread overview]
Message-ID: <1416319366-11539-3-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1416319366-11539-1-git-send-email-akinobu.mita@gmail.com>
If no voltage supply regulators are defined for the UFS devices (assumed
they are always-on), ufshcd_config_vreg_load() can be called on
suspend/resume paths with vreg == NULL as hba->vreg_info.vcc* equal to
NULL, and it causes NULL pointer dereference.
This fixes it by making ufshcd_config_vreg_{h,l}pm noop when no regulators
are defined.
Signed-off-by: Akinobu Mita <mita@fixstars.com>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>
Cc: Subhash Jadavani <subhashj@codeaurora.org>
Cc: Dolev Raviv <draviv@codeaurora.org>
Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>
Cc: Yaniv Gardi <ygardi@codeaurora.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/ufs/ufshcd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 59b6544..d18adc4 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4248,12 +4248,18 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba,
struct ufs_vreg *vreg)
{
+ if (!vreg)
+ return 0;
+
return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA);
}
static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
struct ufs_vreg *vreg)
{
+ if (!vreg)
+ return 0;
+
return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA);
}
--
1.9.1
next prev parent reply other threads:[~2014-11-18 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 14:02 [PATCH 0/2] UFS driver fixes for v3.18 Akinobu Mita
2014-11-18 14:02 ` [PATCH 1/2] scsi: ufs: fix reference counting of W-LUs Akinobu Mita
2014-11-22 1:23 ` Subhash Jadavani
2014-11-18 14:02 ` Akinobu Mita [this message]
2014-11-22 1:21 ` [PATCH 2/2] scsi: ufs: fix NULL dereference when no regulators are defined Subhash Jadavani
2014-11-20 6:45 ` [PATCH 0/2] UFS driver fixes for v3.18 Christoph Hellwig
2014-11-20 11:45 ` merez
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=1416319366-11539-3-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=JBottomley@parallels.com \
--cc=draviv@codeaurora.org \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=mita@fixstars.com \
--cc=sthumma@codeaurora.org \
--cc=subhashj@codeaurora.org \
--cc=vinholikatti@gmail.com \
--cc=ygardi@codeaurora.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.