From da671c053375bcabe7698de8cd91540e9b53fc6c Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 11 Jul 2008 11:22:19 +0000 Subject: Make it atomic for the devfs_populate_loop() to see the setting of SI_ALIAS flag and initialization of the si_parent when alias is created. Assert that supplied parent device is not NULL. Both situations could cause NULL dereference in the devfs_populate_loop() when creating a symlink for SI_ALIAS'ed device. Namely, cdp->cdp_c.si_parent may be NULL. Reported by: mav MFC after: 2 weeks --- sys/kern/kern_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/kern/kern_conf.c') diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index e328ca9..4c10871 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -780,6 +780,7 @@ make_dev_alias(struct cdev *pdev, const char *fmt, ...) va_list ap; int i; + KASSERT(pdev != NULL, ("NULL pdev")); dev = devfs_alloc(); dev_lock(); dev->si_flags |= SI_ALIAS; @@ -793,9 +794,9 @@ make_dev_alias(struct cdev *pdev, const char *fmt, ...) va_end(ap); devfs_create(dev); + dev_dependsl(pdev, dev); clean_unrhdrl(devfs_inos); dev_unlock(); - dev_depends(pdev, dev); notify_create(dev); -- cgit v1.1