diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2015-05-19 14:30:12 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2015-05-19 14:30:12 +0200 |
commit | cc6f67bcafcb6bbbb2d1be1603dcd95125a52800 (patch) | |
tree | 0d3cb24661ad0c375540791ec24c6fc80760f5b3 /fs/overlayfs/copy_up.c | |
parent | d377c5eb54dd05aeb3094b7740252d19ba7791f7 (diff) | |
download | linux-stable-cc6f67bcafcb6bbbb2d1be1603dcd95125a52800.tar.gz linux-stable-cc6f67bcafcb6bbbb2d1be1603dcd95125a52800.tar.bz2 linux-stable-cc6f67bcafcb6bbbb2d1be1603dcd95125a52800.zip |
ovl: mount read-only if workdir can't be created
OpenWRT folks reported that overlayfs fails to mount if upper fs is full,
because workdir can't be created. Wordir creation can fail for various
other reasons too.
There's no reason that the mount itself should fail, overlayfs can work
fine without a workdir, as long as the overlay isn't modified.
So mount it read-only and don't allow remounting read-write.
Add a couple of WARN_ON()s for the impossible case of workdir being used
despite being read-only.
Reported-by: Bastian Bittorf <bittorf@bluebottle.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: <stable@vger.kernel.org> # v3.18+
Diffstat (limited to 'fs/overlayfs/copy_up.c')
-rw-r--r-- | fs/overlayfs/copy_up.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 24f640441bd9..84d693d37428 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -299,6 +299,9 @@ int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, struct cred *override_cred; char *link = NULL; + if (WARN_ON(!workdir)) + return -EROFS; + ovl_path_upper(parent, &parentpath); upperdir = parentpath.dentry; |