ses: don't panic if disk elements have really weird descriptors

SES allows element descriptors to contain characters like spaces and
quotes that devfs does not allow to appear in device aliases.  Since SES
element descriptors are outside of the kernel's control, we should
gracefully handle a failure to create a device physical path alias.

PR:		264513
Reported by:	Yuri <yuri@aetern.org>
Reviewed by:	imp, mav
Sponsored by:	Axcient
MFC after:	2 weeks
This commit is contained in:
Alan Somers 2022-06-10 16:44:59 -06:00
parent 1f1e2261e3
commit 5f438dd3ac
2 changed files with 5 additions and 4 deletions

View File

@ -457,8 +457,9 @@ pass_add_physpath(void *context, int pending)
"GEOM::physpath", periph->path) == 0
&& strlen(physpath) != 0) {
mtx_unlock(mtx);
make_dev_physpath_alias(MAKEDEV_WAITOK, &softc->alias_dev,
softc->dev, softc->alias_dev, physpath);
make_dev_physpath_alias(MAKEDEV_WAITOK | MAKEDEV_CHECKNAME,
&softc->alias_dev, softc->dev,
softc->alias_dev, physpath);
mtx_lock(mtx);
}

View File

@ -273,8 +273,8 @@ g_dev_set_physpath(struct g_consumer *cp)
dev = sc->sc_dev;
old_alias_dev = sc->sc_alias;
alias_devp = (struct cdev **)&sc->sc_alias;
make_dev_physpath_alias(MAKEDEV_WAITOK, alias_devp, dev,
old_alias_dev, physpath);
make_dev_physpath_alias(MAKEDEV_WAITOK | MAKEDEV_CHECKNAME,
alias_devp, dev, old_alias_dev, physpath);
} else if (sc->sc_alias) {
destroy_dev((struct cdev *)sc->sc_alias);
sc->sc_alias = NULL;