|
@@ -9,6 +9,7 @@
|
|
|
|
|
|
|
|
#include <linux/fs.h>
|
|
#include <linux/fs.h>
|
|
|
#include <linux/cred.h>
|
|
#include <linux/cred.h>
|
|
|
|
|
+#include <linux/ctype.h>
|
|
|
#include <linux/namei.h>
|
|
#include <linux/namei.h>
|
|
|
#include <linux/xattr.h>
|
|
#include <linux/xattr.h>
|
|
|
#include <linux/ratelimit.h>
|
|
#include <linux/ratelimit.h>
|
|
@@ -467,6 +468,12 @@ static struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
|
|
|
return upper;
|
|
return upper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* Is this a leftover from create/whiteout of directory index entry? */
|
|
|
|
|
+static bool ovl_is_temp_index(struct dentry *index)
|
|
|
|
|
+{
|
|
|
|
|
+ return index->d_name.name[0] == '#';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Verify that an index entry name matches the origin file handle stored in
|
|
* Verify that an index entry name matches the origin file handle stored in
|
|
|
* OVL_XATTR_ORIGIN and that origin file handle can be decoded to lower path.
|
|
* OVL_XATTR_ORIGIN and that origin file handle can be decoded to lower path.
|
|
@@ -484,6 +491,11 @@ int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
|
|
|
if (!d_inode(index))
|
|
if (!d_inode(index))
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
+ /* Cleanup leftover from index create/cleanup attempt */
|
|
|
|
|
+ err = -ESTALE;
|
|
|
|
|
+ if (ovl_is_temp_index(index))
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+
|
|
|
err = -EINVAL;
|
|
err = -EINVAL;
|
|
|
if (index->d_name.len < sizeof(struct ovl_fh)*2)
|
|
if (index->d_name.len < sizeof(struct ovl_fh)*2)
|
|
|
goto fail;
|
|
goto fail;
|