- Assert that dm_lock is exclusively held in devfs_rules_apply() and

in devfs_vmkdir() while adding the entry to de_list of the parent.
- Apply devfs rules to newly created directories and symbolic links.

PR:		kern/125034
Submitted by:	Mateusz Guzik (original version)
This commit is contained in:
Jaakko Heinonen 2010-12-15 16:42:44 +00:00
parent 607ccc8676
commit ef456eec95
3 changed files with 5 additions and 0 deletions

View file

@ -281,8 +281,10 @@ devfs_vmkdir(struct devfs_mount *dmp, char *name, int namelen, struct devfs_dire
de->de_dir = dd;
} else {
de->de_dir = dotdot;
sx_assert(&dmp->dm_lock, SX_XLOCKED);
TAILQ_INSERT_TAIL(&dotdot->de_dlist, dd, de_list);
dotdot->de_links++;
devfs_rules_apply(dmp, dd);
}
#ifdef MAC

View file

@ -139,6 +139,8 @@ devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de)
{
struct devfs_ruleset *ds;
sx_assert(&dm->dm_lock, SX_XLOCKED);
if (dm->dm_ruleset == 0)
return;
sx_slock(&sx_rules);

View file

@ -1589,6 +1589,7 @@ devfs_symlink(struct vop_symlink_args *ap)
de_dotdot = TAILQ_NEXT(de_dotdot, de_list); /* ".." */
TAILQ_INSERT_AFTER(&dd->de_dlist, de_dotdot, de, de_list);
devfs_dir_ref_de(dmp, dd);
devfs_rules_apply(dmp, de);
return (devfs_allocv(de, ap->a_dvp->v_mount, LK_EXCLUSIVE, ap->a_vpp));
}