linux-stable/drivers/platform/x86
ChiYuan Huang cb29811d98 regulator: core: Use different devices for resource allocation and DT lookup
[ Upstream commit 8f3cbcd6b4 ]

Following by the below discussion, there's the potential UAF issue
between regulator and mfd.
https://lore.kernel.org/all/20221128143601.1698148-1-yangyingliang@huawei.com/

From the analysis of Yingliang

CPU A				|CPU B
mt6370_probe()			|
  devm_mfd_add_devices()	|
				|mt6370_regulator_probe()
				|  regulator_register()
				|    //allocate init_data and add it to devres
				|    regulator_of_get_init_data()
i2c_unregister_device()		|
  device_del()			|
    devres_release_all()	|
      // init_data is freed	|
      release_nodes()		|
				|  // using init_data causes UAF
				|  regulator_register()

It's common to use mfd core to create child device for the regulator.
In order to do the DT lookup for init data, the child that registered
the regulator would pass its parent as the parameter. And this causes
init data resource allocated to its parent, not itself. The issue happen
when parent device is going to release and regulator core is still doing
some operation of init data constraint for the regulator of child device.

To fix it, this patch expand 'regulator_register' API to use the
different devices for init data allocation and DT lookup.

Reported-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1670311341-32664-1-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:26:47 +01:00
..
amd platform/x86/amd: pmc: Add new ACPI ID AMDI0009 2022-11-26 09:27:42 +01:00
dell platform/x86/dell: Kconfig: Remove unnecessary "depends on X86_PLATFORM_DEVICES" 2022-06-27 09:37:49 +02:00
intel regulator: core: Use different devices for resource allocation and DT lookup 2022-12-31 13:26:47 +01:00
acer-wireless.c
acer-wmi.c platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017) 2022-12-02 17:43:15 +01:00
acerhdf.c platform/x86: acerhdf: Cleanup str_starts_with() 2022-04-04 15:50:23 +02:00
adv_swbutton.c
amilo-rfkill.c
apple-gmux.c platform/x86: apple-gmux: Use backlight helper 2022-06-22 11:53:45 +02:00
asus-laptop.c
asus-nb-wmi.c platform/x86: asus-wmi: Add support for ROG X13 tablet mode 2022-12-14 11:40:51 +01:00
asus-tf103c-dock.c
asus-wireless.c
asus-wmi.c platform/x86: asus-wmi: Add support for ROG X13 tablet mode 2022-12-14 11:40:51 +01:00
asus-wmi.h platform/x86: asus-wmi: Add support for ROG X13 tablet mode 2022-12-14 11:40:51 +01:00
barco-p50-gpio.c platform/x86: barco-p50-gpio: Add check for platform_driver_register 2022-06-10 21:59:08 +02:00
classmate-laptop.c
compal-laptop.c platform/x86: compal-laptop: Use backlight helper 2022-06-22 11:53:56 +02:00
dual_accel_detect.h
eeepc-laptop.c
eeepc-wmi.c
firmware_attributes_class.c
firmware_attributes_class.h
fujitsu-laptop.c
fujitsu-tablet.c
gigabyte-wmi.c platform/x86: gigabyte-wmi: add support for B660I AORUS PRO DDR4 2022-07-10 17:41:05 +02:00
gpd-pocket-fan.c
hdaps.c
hp-wmi.c platform/x86: hp-wmi: Ignore Smart Experience App event 2022-12-02 17:43:15 +01:00
hp_accel.c
huawei-wmi.c platform/x86: huawei-wmi: fix return value calculation 2022-12-31 13:25:43 +01:00
ibm_rtl.c
ideapad-laptop.c platform/x86: ideapad-laptop: Add module parameters to match DMI quirk tables 2022-12-02 17:43:16 +01:00
intel_ips.c
intel_ips.h
intel_scu_ipc.c platform/x86: intel_scu_ipc: fix possible name leak in __intel_scu_ipc_register() 2022-12-31 13:25:47 +01:00
intel_scu_ipcutil.c
intel_scu_pcidrv.c
intel_scu_pltdrv.c
intel_scu_wdt.c
Kconfig platform/x86: p2sb: Move out of X86_PLATFORM_DEVICES dependency 2022-08-01 16:26:38 +02:00
lenovo-yogabook-wmi.c
lg-laptop.c lg-laptop: Move setting of battery charge limit to common location 2022-02-23 11:36:24 +01:00
Makefile platform/x86: p2sb: Move out of X86_PLATFORM_DEVICES dependency 2022-08-01 16:26:38 +02:00
meraki-mx100.c
mlx-platform.c platform/x86: mlx-platform: Add COME board revision register 2022-07-14 22:34:40 +02:00
msi-laptop.c platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading 2022-10-21 12:39:14 +02:00
msi-wmi.c
mxm-wmi.c platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]() 2022-12-31 13:25:47 +01:00
nvidia-wmi-ec-backlight.c
p2sb.c platform/x86: p2sb: Don't fail if unknown CPU is found 2022-11-16 10:03:55 +01:00
panasonic-laptop.c platform/x86: panasonic-laptop: filter out duplicate volume up/down/mute keypresses 2022-06-28 21:54:50 +02:00
pcengines-apuv2.c
peaq-wmi.c
pmc_atom.c platform/x86: pmc_atom: Improve quirk message to be less cryptic 2022-10-21 12:39:13 +02:00
samsung-laptop.c platform/x86: samsung-laptop: use kobj_to_dev() 2022-05-12 15:37:53 +02:00
samsung-q10.c
serial-multi-instantiate.c sound fixes for 6.0-rc2 2022-08-19 09:46:11 -07:00
simatic-ipc.c leds: simatic-ipc-leds-gpio: Add GPIO version of Siemens driver 2022-07-14 10:50:43 +01:00
sony-laptop.c platform/x86: sony-laptop: Remove useless comparisons in sony_pic_read_possible_resource() 2022-07-28 19:41:29 +02:00
system76_acpi.c platform/x86: system76_acpi: Use dev_get_drvdata 2022-06-12 14:41:22 +02:00
tc1100-wmi.c
think-lmi.c platform/x86: think-lmi: certificate support clean ups 2022-04-04 15:20:53 +02:00
think-lmi.h platform/x86: think-lmi: certificate support clean ups 2022-04-04 15:20:53 +02:00
thinkpad_acpi.c platform/x86: thinkpad_acpi: Enable s2idle quirk for 21A1 machine type 2022-12-02 17:43:15 +01:00
topstar-laptop.c
toshiba-wmi.c
toshiba_acpi.c platform/x86: toshiba_acpi: use kobj_to_dev() 2022-05-12 15:37:53 +02:00
toshiba_bluetooth.c
toshiba_haps.c
touchscreen_dmi.c platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1 2022-12-02 17:43:00 +01:00
uv_sysfs.c
winmate-fm07-keys.c platform/x86: winmate-fm07-keys: Winmate FM07/FM07P buttons 2022-04-13 13:49:48 +02:00
wireless-hotkey.c
wmi-bmof.c
wmi.c platform/x86: wmi: replace usage of found with dedicated list iterator variable 2022-04-13 13:49:48 +02:00
x86-android-tablets.c platform/x86: x86-android-tablets: Fix broken touchscreen on Chuwi Hi8 with Windows BIOS 2022-08-15 13:20:28 +02:00
xiaomi-wmi.c
xo1-rfkill.c
xo15-ebook.c