Skip to content

Commit b02eec4

Browse files
ukleinekgregkh
authored andcommitted
ACPI: APEI: EINJ: Fix resource leak by remove callback in .exit.text
commit b21d1fb upstream. 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9080946 commit b02eec4

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
@@ -842,7 +842,7 @@ static int __init einj_probe(struct faux_device *fdev)
842842
return rc;
843843
}
844844

845-
static void __exit einj_remove(struct faux_device *fdev)
845+
static void einj_remove(struct faux_device *fdev)
846846
{
847847
struct apei_exec_context ctx;
848848

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

866866
static struct faux_device *einj_dev;
867-
/*
868-
* einj_remove() lives in .exit.text. For drivers registered via
869-
* platform_driver_probe() this is ok because they cannot get unbound at
870-
* runtime. So mark the driver struct with __refdata to prevent modpost
871-
* triggering a section mismatch warning.
872-
*/
873-
static struct faux_device_ops einj_device_ops __refdata = {
867+
static struct faux_device_ops einj_device_ops = {
874868
.probe = einj_probe,
875-
.remove = __exit_p(einj_remove),
869+
.remove = einj_remove,
876870
};
877871

878872
static int __init einj_init(void)

0 commit comments

Comments
 (0)