Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Apr 2026 15:29:00 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 03792b24472f - stable/15 - acpi: Reject duplicate handlers for ioctl commands
Message-ID:  <69eb8c3c.33ef3.62d53012@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=03792b24472f6dc3a043007c7eef455291737889

commit 03792b24472f6dc3a043007c7eef455291737889
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-26 15:36:38 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-24 15:26:38 +0000

    acpi: Reject duplicate handlers for ioctl commands
    
    Reviewed by:    imp
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D54311
    
    (cherry picked from commit 4eb560faa725771e536a850a9467fbb592ab3c1b)
---
 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 bac5b8c889e0..47c8ae1d1d6b 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -4109,7 +4109,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);
@@ -4122,6 +4122,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);
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69eb8c3c.33ef3.62d53012>