aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2022-06-10 22:44:59 +0000
committerAlan Somers <asomers@FreeBSD.org>2022-08-20 02:51:58 +0000
commit3c69525933e1ae5f0e7149ef30320bf4e64d9628 (patch)
tree3d722570198930d7fe1177ffea6f545284f984e2
parent93891ed2f794ba871f8cae5cc5fc04abced2d157 (diff)
downloadsrc-3c69525933e1ae5f0e7149ef30320bf4e64d9628.tar.gz
src-3c69525933e1ae5f0e7149ef30320bf4e64d9628.zip
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 (cherry picked from commit 5f438dd3acba47e54e63b13bfff31a49bcc6ddea)
-rw-r--r--sys/cam/scsi/scsi_pass.c5
-rw-r--r--sys/geom/geom_dev.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 965ac00539e1..2d44a44ad4d9 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -459,8 +459,9 @@ pass_add_physpath(void *context, int pending)
&& 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);
}
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 1d20e4e0bf0e..1a33b35c4b02 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -258,8 +258,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;