Skip to contentSkip to conversation

mfd: intel_quark_i2c_gpio: fix write to const mem

PATCH New Tong Zhang 1 participant 1 message Mar 20, 2021 Multifunction devices (MFD)

lore
Share & tools
lore

Tong Zhang

author
#0 lore raw

PATCH 1/1 mfd: intel_quark_i2c_gpio: fix write to const mem

intel_quark_i2c_res and intel_quark_gpio_res are written by intel_quark_mfd_probe. Making them const can cause page fault.

[    1.319934] BUG: unable to handle page fault for address: ffffffffc00be140
[    1.320296] #PF: supervisor write access in kernel mode
[    1.320571] #PF: error_code(0x0003) - permissions violation
[    1.322419] RIP: 0010:intel_quark_mfd_probe+0xb7/0x23e [intel_quark_i2c_gpio]
[    1.327670] Call Trace:
[    1.327800]  local_pci_probe+0x48/0x80
Fixes c4a164f41554 (mfd: Constify static struct resources)
---
 drivers/mfd/intel_quark_i2c_gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +2 -2
index fe8ca945f367..84ca7902e1df 100644
@@ -72,7 +72,7 @@ static const struct dmi_system_id dmi_platform_info[] = {
 	{}
 };
 
-static const struct resource intel_quark_i2c_res[] = {
+static struct resource intel_quark_i2c_res[] = {
 	[INTEL_QUARK_IORES_MEM] = {
 		.flags = IORESOURCE_MEM,
 	},
@@ -85,7 +85,7 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = {
 	.adr = MFD_ACPI_MATCH_I2C,
 };
 
-static const struct resource intel_quark_gpio_res[] = {
+static struct resource intel_quark_gpio_res[] = {
 	[INTEL_QUARK_IORES_MEM] = {
 		.flags = IORESOURCE_MEM,
 	},
Signature · 1 line
2.25.1