git: 4eb560faa725 - main - acpi: Reject duplicate handlers for ioctl commands
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Dec 2025 15:43:51 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=4eb560faa725771e536a850a9467fbb592ab3c1b
commit 4eb560faa725771e536a850a9467fbb592ab3c1b
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-26 15:36:38 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-12-26 15:36:38 +0000
acpi: Reject duplicate handlers for ioctl commands
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54311
---
sys/dev/acpica/acpi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 0549c83ded79..e49d3b4d1637 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -4203,7 +4203,7 @@ static int acpi_ioctl_hooks_initted;
int
acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg)
{
- struct acpi_ioctl_hook *hp;
+ struct acpi_ioctl_hook *hp, *thp;
if ((hp = malloc(sizeof(*hp), M_ACPIDEV, M_NOWAIT)) == NULL)
return (ENOMEM);
@@ -4216,6 +4216,14 @@ acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg)
TAILQ_INIT(&acpi_ioctl_hooks);
acpi_ioctl_hooks_initted = 1;
}
+ TAILQ_FOREACH(thp, &acpi_ioctl_hooks, link) {
+ if (thp->cmd == cmd) {
+ ACPI_UNLOCK(acpi);
+ free(hp, M_ACPIDEV);
+ return (EBUSY);
+ }
+ }
+
TAILQ_INSERT_TAIL(&acpi_ioctl_hooks, hp, link);
ACPI_UNLOCK(acpi);