aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/bus.h
diff options
context:
space:
mode:
authorBen Widawsky <bwidawsk@FreeBSD.org>2018-11-19 18:29:03 +0000
committerBen Widawsky <bwidawsk@FreeBSD.org>2018-11-19 18:29:03 +0000
commit1a305bda15c1153ab79dd8e9bff792be9a3c8150 (patch)
tree9d015f9e6ef15f509918efba0256731a7c277175 /sys/sys/bus.h
parenta4f02d5d6d89fd2f0f40311d6902edab176a4bbb (diff)
downloadsrc-1a305bda15c1153ab79dd8e9bff792be9a3c8150.tar.gz
src-1a305bda15c1153ab79dd8e9bff792be9a3c8150.zip
acpi: fix acpi_ec_probe to only check EC devices
This patch utilizes the fixed_devclass attribute in order to make sure other acpi devices with params don't get confused for an EC device. The existing code assumes that acpi_ec_probe is only ever called with a dereferencable acpi param. Aside from being incorrect because other devices of ACPI_TYPE_DEVICE may be probed here which aren't ec devices, (and they may have set acpi private data), it is even more nefarious if another ACPI driver uses private data which is not dereferancable. This will result in a pointer deref during boot and therefore boot failure. On X86, as it stands today, no other devices actually do this (acpi_cpu checks for PROCESSOR type devices) and so there is no issue. I ran into this because I am adding such a device which gets probed before acpi_ec_probe and sets private data. If ARM ever has an EC, I think they'd run into this issue as well. There have been several iterations of this patch. Earlier iterations had ECDT enumerated ECs not call into the probe/attach functions of this driver. This change was Suggested by: jhb@. Reviewed by: jhb Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D16635
Notes
Notes: svn path=/head/; revision=340644
Diffstat (limited to 'sys/sys/bus.h')
-rw-r--r--sys/sys/bus.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index e565002760d7..3f695321c3cb 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -612,6 +612,7 @@ void device_set_desc(device_t dev, const char* desc);
void device_set_desc_copy(device_t dev, const char* desc);
int device_set_devclass(device_t dev, const char *classname);
int device_set_devclass_fixed(device_t dev, const char *classname);
+bool device_is_devclass_fixed(device_t dev);
int device_set_driver(device_t dev, driver_t *driver);
void device_set_flags(device_t dev, u_int32_t flags);
void device_set_softc(device_t dev, void *softc);