Skip to content

Commit c4a0965

Browse files
committed
ACPI: APEI: EINJ: Fix resource leak by remove callback in .exit.text
JIRA: https://issues.redhat.com/browse/RHEL-114092 commit b21d1fb Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Date: Mon, 18 Aug 2025 18:18:33 +0000 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: 6cb9441 ("ACPI: APEI: EINJ: Transition to the faux device interface") Signed-off-by: Uwe 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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent 79531bb commit c4a0965

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/acpi/apei/einj-core.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ static int __init einj_probe(struct faux_device *fdev)
10941094
return rc;
10951095
}
10961096

1097-
static void __exit einj_remove(struct faux_device *fdev)
1097+
static void einj_remove(struct faux_device *fdev)
10981098
{
10991099
struct apei_exec_context ctx;
11001100

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

11191119
static struct faux_device *einj_dev;
1120-
/*
1121-
* einj_remove() lives in .exit.text. For drivers registered via
1122-
* platform_driver_probe() this is ok because they cannot get unbound at
1123-
* runtime. So mark the driver struct with __refdata to prevent modpost
1124-
* triggering a section mismatch warning.
1125-
*/
1126-
static struct faux_device_ops einj_device_ops __refdata = {
1120+
static struct faux_device_ops einj_device_ops = {
11271121
.probe = einj_probe,
1128-
.remove = __exit_p(einj_remove),
1122+
.remove = einj_remove,
11291123
};
11301124

11311125
static int __init einj_init(void)

0 commit comments

Comments
 (0)