diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2011-08-04 13:56:28 +0200 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2011-11-16 14:25:40 -0700 |
commit | 9b2a85d54b3c5fa5403375bb6cf0df688b0847dd (patch) | |
tree | 8afe4cff991204f58a787292355ff8cd6d730b31 /include | |
parent | efbe2adbae30e2e8dd2d24bba23bc2cbe9df2a1a (diff) |
fs: limit filesystem stacking depth
Add a simple read-only counter to super_block that indicates 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.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index bd859aec437..b538453a251 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -481,6 +481,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 * @@ -1461,6 +1467,11 @@ struct super_block { int cleancache_poolid; struct shrinker s_shrink; /* per-sb shrinker handle */ + + /* + * Indicates how deep in a filesystem stack this SB is + */ + int s_stack_depth; }; /* superblock cache pruning functions */ |