fs: Prevent mounting file system re-using private data
The commit changes the fs_mount to not allow mounting same system,
with the same private data pointer, at two different mount paths.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
diff --git a/subsys/fs/fs.c b/subsys/fs/fs.c
index f8460dc..94b7c91 100644
--- a/subsys/fs/fs.c
+++ b/subsys/fs/fs.c
@@ -677,6 +677,12 @@
continue;
}
+ CHECKIF(mp->fs_data == itr->fs_data) {
+ LOG_ERR("file system already mounted!!");
+ rc = -EBUSY;
+ goto mount_err;
+ }
+
if (strncmp(mp->mnt_point, itr->mnt_point, len) == 0) {
LOG_ERR("mount point already exists!!");
rc = -EBUSY;