fs: limit filesystem stacking depth
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 23 Oct 2014 22:14:39 +0000 (00:14 +0200)
committerManish Tuteja <mtuteja@nvidia.com>
Mon, 17 Apr 2017 23:56:03 +0000 (16:56 -0700)
commitbdf94e85be19fd3b91669427343d6fde4177fb83
tree6e485d4b574f32f557a6f3b53a236ccf86fd1a83
parent4e811459502fbf165d5148f9b0f2cdae03077a45
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.

Bug 1887273
Bug 200288656

Change-Id: Ibaa154eb2b102d02370fe2003387b0131fe2955a
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1455849
(cherry picked from commit 5fa62435eaef75e479c0c157b4d911344f64b002)
Reviewed-on: http://git-master/r/1459845
(cherry picked from commit f9aa5494d35892be63c7268deb7fe7adacb6123e)
Reviewed-on: http://git-master/r/1463477
GVS: Gerrit_Virtual_Submit
Reviewed-by: Manish Tuteja <mtuteja@nvidia.com>
fs/ecryptfs/main.c
include/linux/fs.h