Message ID | 20201228185433.61129-3-ebiggers@kernel.org |
---|---|
State | New |
Headers | show |
Series | fscrypt: prevent creating duplicate encrypted filenames | expand |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 36a81b57012a5..59038e361337c 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2192,6 +2192,9 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, if (!dentry->d_name.len) return -EINVAL; + if (fscrypt_is_nokey_name(dentry)) + return -ENOKEY; + #ifdef CONFIG_UNICODE if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) && sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))