summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2009-03-23 01:13:34 +0000
committerkan <kan@FreeBSD.org>2009-03-23 01:13:34 +0000
commitab12866f38f18e071995e52a067aa9aa8060e393 (patch)
tree691aa7386805313d20ae838598a2ae1239bb4d31 /sys/kern/subr_bus.c
parent45260b3031008fb957584f30d894a92e9ff8bd6c (diff)
downloadFreeBSD-src-ab12866f38f18e071995e52a067aa9aa8060e393.zip
FreeBSD-src-ab12866f38f18e071995e52a067aa9aa8060e393.tar.gz
Add safety check that does not allow empty strings to be queued
to the devctl notification queue. Empty strings cause devctl read call to return 0 and result in devd exiting prematurely. The actual offender (ugen notes for root hubs) will be fixed by separate commit.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 3c526a6..70531ef 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -532,6 +532,12 @@ devctl_queue_data(char *data)
struct dev_event_info *n1 = NULL;
struct proc *p;
+ /*
+ * Do not allow empty strings to be queued, as they
+ * cause devd to exit prematurely.
+ */
+ if (strlen(data) == 0)
+ return;
n1 = malloc(sizeof(*n1), M_BUS, M_NOWAIT);
if (n1 == NULL)
return;
OpenPOWER on IntegriCloud