[PATCH 1/4] fs: devfs: Allow mounting only on /dev/

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 13 00:51:51 PDT 2015


We have places in the code where we assume that devfs is mounted on
/dev/, so enforce this path to avoid surprises.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/devfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/devfs.c b/fs/devfs.c
index c6db25c..5c96682 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -228,6 +228,13 @@ static int devfs_stat(struct device_d *_dev, const char *filename, struct stat *
 
 static int devfs_probe(struct device_d *dev)
 {
+	struct fs_device_d *fsdev = dev_to_fs_device(dev);
+
+	if (strcmp(fsdev->path, "/dev")) {
+		dev_err(dev, "devfs can only be mounted on /dev/\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
-- 
2.6.0




More information about the barebox mailing list