aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-10-24 00:14:39 +0200
committerMister Oyster <oysterized@gmail.com>2017-04-16 15:03:46 +0200
commit56673e746547df572ed0da2a46ce7cb65791a649 (patch)
tree544ac430ecb76f453af08677b82746251907e01b /include
parentd30927e95ba09729cbc18ec08f85711a2bf0c7dd (diff)
fs: limit filesystem stacking depth
Add a simple read-only counter to super_block that indicates how deep this is in the stack of filesystems. Previously ecryptfs was the only stackable filesystem and it explicitly disallowed multiple layers of itself. Overlayfs, however, can be stacked recursively and also may be stacked on top of ecryptfs or vice versa. To limit the kernel stack usage we must limit the depth of the filesystem stack. Initially the limit is set to 2. Change-Id: I91549cf876ed11a4265487f6b2d980b459399f9d Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b1f9dab55..60bdc669b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -252,6 +252,12 @@ struct iattr {
*/
#include <linux/quota.h>
+/*
+ * Maximum number of layers of fs stack. Needs to be limited to
+ * prevent kernel stack overflow
+ */
+#define FILESYSTEM_MAX_STACK_DEPTH 2
+
/**
* enum positive_aop_returns - aop return codes with specific semantics
*
@@ -1322,6 +1328,11 @@ struct super_block {
struct shrinker s_shrink; /* per-sb shrinker handle */
+ /*
+ * Indicates how deep in a filesystem stack this SB is
+ */
+ int s_stack_depth;
+
/* Number of inodes with nlink == 0 but still referenced */
atomic_long_t s_remove_count;