Whamcloud - gitweb
LU-14629 sec: forbid file rename from enc to unencrypted dir
[fs/lustre-release.git] / lustre / llite / namei.c
index 8470499..bcfdf37 100644 (file)
@@ -1874,6 +1874,11 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild,
 #endif
        if (err)
                RETURN(err);
+       /* we prevent an encrypted file from being renamed
+        * into an unencrypted dir
+        */
+       if (IS_ENCRYPTED(src) && !IS_ENCRYPTED(tgt))
+               RETURN(-EXDEV);
 
        if (src_dchild->d_inode)
                mode = src_dchild->d_inode->i_mode;