[PATCH] exportfs: make root unexportable
From: Roberto Bergantinos Corpas <hidden>
Date: 2021-03-29 10:55:30
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Roberto Bergantinos Corpas <hidden>
Date: 2021-03-29 10:55:30
Subsystem:
the rest · Maintainer:
Linus Torvalds
If root of the filesystem is exported, it cannot be explicitly unexported, since unexportfs_parsed, in order to deal with trailing '/', will leave nlen at 0 for root exported case Signed-off-by: Roberto Bergantinos Corpas <redacted> --- utils/exportfs/exportfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 9fcae0b3..9b6f4f5a 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c@@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose) * so need to deal with it. */ size_t nlen = strlen(path); - while (path[nlen - 1] == '/') + while ((path[nlen - 1] == '/') && (nlen > 1)) nlen--; for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
--
2.21.0