Commit b21d1fbb authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Rafael J. Wysocki
Browse files

ACPI: APEI: EINJ: Fix resource leak by remove callback in .exit.text



The .remove() callback is also used during error handling in
faux_probe(). As einj_remove() was marked with __exit it's not linked
into the kernel if the driver is built-in, potentially resulting in
resource leaks.

Also remove the comment justifying the __exit annotation which doesn't
apply any more since the driver was converted to the faux device
interface.

Fixes: 6cb9441b ("ACPI: APEI: EINJ: Transition to the faux device interface")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@baylibre.com>
Cc: 6.16+ <stable@vger.kernel.org> # 6.16+
Link: https://patch.msgid.link/20250814051157.35867-2-u.kleine-koenig@baylibre.com


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7459e87a
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -1094,7 +1094,7 @@ static int __init einj_probe(struct faux_device *fdev)
	return rc;
}

static void __exit einj_remove(struct faux_device *fdev)
static void einj_remove(struct faux_device *fdev)
{
	struct apei_exec_context ctx;

@@ -1117,15 +1117,9 @@ static void __exit einj_remove(struct faux_device *fdev)
}

static struct faux_device *einj_dev;
/*
 * einj_remove() lives in .exit.text. For drivers registered via
 * platform_driver_probe() this is ok because they cannot get unbound at
 * runtime. So mark the driver struct with __refdata to prevent modpost
 * triggering a section mismatch warning.
 */
static struct faux_device_ops einj_device_ops __refdata = {
static struct faux_device_ops einj_device_ops = {
	.probe = einj_probe,
	.remove = __exit_p(einj_remove),
	.remove = einj_remove,
};

static int __init einj_init(void)