Skip to content

Commit 977c6ba

Browse files
Mani-Sadhasivambp3tk0v
authored andcommitted
EDAC/qcom: Do not pass llcc_driv_data as edac_device_ctl_info's pvt_info
The memory for llcc_driv_data is allocated by the LLCC driver. But when it is passed as the private driver info to the EDAC core, it will get freed during the qcom_edac driver release. So when the qcom_edac driver gets probed again, it will try to use the freed data leading to the use-after-free bug. Hence, do not pass llcc_driv_data as pvt_info but rather reference it using the platform_data pointer in the qcom_edac driver. Fixes: 2745065 ("drivers: edac: Add EDAC driver support for QCOM SoCs") Reported-by: Steev Klimaszewski <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> # Thinkpad X13s Tested-by: Andrew Halaney <[email protected]> # sa8540p-ride Cc: <[email protected]> # 4.20 Link: https://lore.kernel.org/r/[email protected]
1 parent cec669f commit 977c6ba

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/edac/qcom_edac.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ dump_syn_reg_values(struct llcc_drv_data *drv, u32 bank, int err_type)
252252
static int
253253
dump_syn_reg(struct edac_device_ctl_info *edev_ctl, int err_type, u32 bank)
254254
{
255-
struct llcc_drv_data *drv = edev_ctl->pvt_info;
255+
struct llcc_drv_data *drv = edev_ctl->dev->platform_data;
256256
int ret;
257257

258258
ret = dump_syn_reg_values(drv, bank, err_type);
@@ -289,7 +289,7 @@ static irqreturn_t
289289
llcc_ecc_irq_handler(int irq, void *edev_ctl)
290290
{
291291
struct edac_device_ctl_info *edac_dev_ctl = edev_ctl;
292-
struct llcc_drv_data *drv = edac_dev_ctl->pvt_info;
292+
struct llcc_drv_data *drv = edac_dev_ctl->dev->platform_data;
293293
irqreturn_t irq_rc = IRQ_NONE;
294294
u32 drp_error, trp_error, i;
295295
int ret;
@@ -358,7 +358,6 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev)
358358
edev_ctl->dev_name = dev_name(dev);
359359
edev_ctl->ctl_name = "llcc";
360360
edev_ctl->panic_on_ue = LLCC_ERP_PANIC_ON_UE;
361-
edev_ctl->pvt_info = llcc_driv_data;
362361

363362
rc = edac_device_add_device(edev_ctl);
364363
if (rc)

0 commit comments

Comments
 (0)