RE: [PATCH 1/2] EDAC/igen6: Avoid segmentation fault when rmmod

From: Zhuo, Qiuxu
Date: Sat Nov 02 2024 - 03:45:25 EST


> From: Orange Kao <orange@xxxxxxxx>
> [...]
> Subject: [PATCH 1/2] EDAC/igen6: Avoid segmentation fault when rmmod

This is a bug. Let's fix it. Suggested subject as fellow:

EDAC/igen6: Fix segmentation fault when rmmod

> The segmentation fault happens because
> During modprobe:
> 1. In igen6_probe(), igen6_pvt will be allocated with kzalloc() 2. In
> igen6_register_mci(), mci->pvt_info will point to
> &igen6_pvt->imc[mc]
>
> During rmmod:
> 1. In mci_release() in edac_mc.c, it will kfree(mci->pvt_info) 2. In
> igen6_remove(), it will kfree(igen6_pvt);
>
> And that caused double kfree on the same memory address.
> My proposal is to set
> mci->pvt_info to NULL to avoid double-kfree.

Please change the last sentence to:

Fix this issue by setting mci->pvt_info to NULL to avoid the double kfree.

And append the following tags here:

Fixes: 10590a9d4f23 ("EDAC/igen6: Add EDAC driver for Intel client SoCs using IBECC")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219360
Signed-off-by: Orange Kao <orange@xxxxxxxx>

Thanks!
-Qiuxu