diff options
author | kib <kib@FreeBSD.org> | 2008-07-11 11:22:19 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-07-11 11:22:19 +0000 |
commit | da671c053375bcabe7698de8cd91540e9b53fc6c (patch) | |
tree | 6294fcdc2803fe5e7f0520898acbc749df6a8c29 | |
parent | cb7c47a58468a67bf24eebba9bedae5fb97a5f05 (diff) | |
download | FreeBSD-src-da671c053375bcabe7698de8cd91540e9b53fc6c.zip FreeBSD-src-da671c053375bcabe7698de8cd91540e9b53fc6c.tar.gz |
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
-rw-r--r-- | sys/kern/kern_conf.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |