aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/overlayfs/namei.c7
-rw-r--r--fs/overlayfs/readdir.c11
2 files changed, 8 insertions, 10 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 0d9b8ce5ea43..a12dc10bf726 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -405,14 +405,13 @@ int ovl_verify_index(struct dentry *index, struct path *lowerstack,
405 * be treated as stale (i.e. after unlink of the overlay inode). 405 * be treated as stale (i.e. after unlink of the overlay inode).
406 * We don't know the verification rules for directory and whiteout 406 * We don't know the verification rules for directory and whiteout
407 * index entries, because they have not been implemented yet, so return 407 * index entries, because they have not been implemented yet, so return
408 * EROFS if those entries are found to avoid corrupting an index that 408 * EINVAL if those entries are found to abort the mount to avoid
409 * was created by a newer kernel. 409 * corrupting an index that was created by a newer kernel.
410 */ 410 */
411 err = -EROFS; 411 err = -EINVAL;
412 if (d_is_dir(index) || ovl_is_whiteout(index)) 412 if (d_is_dir(index) || ovl_is_whiteout(index))
413 goto fail; 413 goto fail;
414 414
415 err = -EINVAL;
416 if (index->d_name.len < sizeof(struct ovl_fh)*2) 415 if (index->d_name.len < sizeof(struct ovl_fh)*2)
417 goto fail; 416 goto fail;
418 417
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 0f85ee9c3268..698b74dd750e 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -1021,13 +1021,12 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,
1021 break; 1021 break;
1022 } 1022 }
1023 err = ovl_verify_index(index, lowerstack, numlower); 1023 err = ovl_verify_index(index, lowerstack, numlower);
1024 if (err) { 1024 /* Cleanup stale and orphan index entries */
1025 if (err == -EROFS) 1025 if (err && (err == -ESTALE || err == -ENOENT))
1026 break;
1027 err = ovl_cleanup(dir, index); 1026 err = ovl_cleanup(dir, index);
1028 if (err) 1027 if (err)
1029 break; 1028 break;
1030 } 1029
1031 dput(index); 1030 dput(index);
1032 index = NULL; 1031 index = NULL;
1033 } 1032 }