linux/drivers/scsi/ufs
Adrian Hunter 7c7cfdcf7f scsi: ufs: Fix NULL pointer dereference in ufshcd_config_vreg_hpm()
Fix the following BUG:

  [ 187.065689] BUG: kernel NULL pointer dereference, address: 000000000000001c
  [ 187.065790] RIP: 0010:ufshcd_vreg_set_hpm+0x3c/0x110 [ufshcd_core]
  [ 187.065938] Call Trace:
  [ 187.065959] ufshcd_resume+0x72/0x290 [ufshcd_core]
  [ 187.065980] ufshcd_system_resume+0x54/0x140 [ufshcd_core]
  [ 187.065993] ? pci_pm_restore+0xb0/0xb0
  [ 187.066005] ufshcd_pci_resume+0x15/0x20 [ufshcd_pci]
  [ 187.066017] pci_pm_thaw+0x4c/0x90
  [ 187.066030] dpm_run_callback+0x5b/0x150
  [ 187.066043] device_resume+0x11b/0x220

Voltage regulators are optional, so functions must check they exist
before dereferencing.

Note this issue is hidden if CONFIG_REGULATORS is not set, because the
offending code is optimised away.

Notes for stable:

The issue first appears in commit 57d104c153 ("ufs: add UFS power
management support") but is inadvertently fixed in commit 60f0187031
("scsi: ufs: disable vccq if it's not needed by UFS device") which in
turn was reverted by commit 730679817d ("Revert "scsi: ufs: disable vccq
if it's not needed by UFS device""). So fix applies v3.18 to v4.5 and
v5.1+

Fixes: 57d104c153 ("ufs: add UFS power management support")
Fixes: 730679817d ("Revert "scsi: ufs: disable vccq if it's not needed by UFS device"")
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-08-14 22:03:21 -04:00
..
Kconfig SCSI misc on 20190507 2019-05-08 10:12:46 -07:00
Makefile scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips 2019-03-19 16:56:21 -04:00
cdns-pltfrm.c scsi: ufs-cdns: Add support for UFSHCI with M31 PHY 2019-04-03 23:45:59 -04:00
tc-dwc-g210-pci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tc-dwc-g210-pltfrm.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tc-dwc-g210.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tc-dwc-g210.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ufs-hisi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 471 2019-06-19 17:09:11 +02:00
ufs-hisi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 471 2019-06-19 17:09:11 +02:00
ufs-mediatek.c scsi: ufs-mediatek: Add missing MODULE_* information 2019-03-25 22:09:42 -04:00
ufs-mediatek.h scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips 2019-03-19 16:56:21 -04:00
ufs-qcom.c SCSI misc on 20190709 2019-07-11 15:14:01 -07:00
ufs-qcom.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
ufs-sysfs.c scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported() 2019-06-18 19:46:23 -04:00
ufs-sysfs.h scsi: ufs: sysfs: attributes 2018-02-15 18:35:05 -05:00
ufs.h scsi: ufs: Remove unused min_uA field in struct ufs_vreg 2019-04-03 23:11:35 -04:00
ufs_bsg.c scsi: ufs-bsg: complete ufs-bsg job only if no error 2019-06-26 22:42:24 -04:00
ufs_bsg.h scsi: ufs: Add a bsg endpoint that supports UPIUs 2018-10-10 23:09:46 -04:00
ufs_quirks.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
ufshcd-dwc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ufshcd-dwc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ufshcd-pci.c scsi: ufshdc-pci: Add Intel PCI IDs for EHL 2019-06-26 22:42:28 -04:00
ufshcd-pltfrm.c scsi: ufs: Avoid runtime suspend possibly being blocked forever 2019-06-18 22:50:25 -04:00
ufshcd-pltfrm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
ufshcd.c scsi: ufs: Fix NULL pointer dereference in ufshcd_config_vreg_hpm() 2019-08-14 22:03:21 -04:00
ufshcd.h scsi: ufs: Introduce ufshcd_is_auto_hibern8_supported() 2019-06-18 19:46:23 -04:00
ufshci-dwc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ufshci.h scsi: ufs: Add error-handling of Auto-Hibernate 2019-06-18 19:46:23 -04:00
unipro.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00