summaryrefslogtreecommitdiffstats
path: root/fs/devfs.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-10-13 09:34:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-10-15 08:56:21 +0200
commit7c868bd6944101921d2337d12979588ca7d55c53 (patch)
treebea64092e6390731c4d36df0c4dad39cba85e152 /fs/devfs.c
parent04d8c2541d427a04875b7ae4a5862ea567f56df0 (diff)
downloadbarebox-7c868bd6944101921d2337d12979588ca7d55c53.tar.gz
barebox-7c868bd6944101921d2337d12979588ca7d55c53.tar.xz
fs: devfs: Allow mounting only on /dev/
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@pengutronix.de>
Diffstat (limited to 'fs/devfs.c')
-rw-r--r--fs/devfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/devfs.c b/fs/devfs.c
index c6db25cb14..5c96682f96 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;
}