aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2018-06-11 17:41:09 -0400
committerRichard Weinberger <richard@nod.at>2018-08-14 18:06:15 -0400
commit00ee8b60102862f4daf0814d12a2ea2744fc0b9b (patch)
tree9a06483280810a6e0be81e02db844110387a4839
parent94710cac0ef4ee177a63b5227664b38c95bbf703 (diff)
ubifs: Fix directory size calculation for symlinks
We have to account the name of the symlink and not the target length. Fixes: ca7f85be8d6c ("ubifs: Add support for encrypted symlinks") Cc: <stable@vger.kernel.org> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--fs/ubifs/dir.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 9da224d4f2da..e8616040bffc 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1123,8 +1123,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
1123 struct ubifs_inode *ui; 1123 struct ubifs_inode *ui;
1124 struct ubifs_inode *dir_ui = ubifs_inode(dir); 1124 struct ubifs_inode *dir_ui = ubifs_inode(dir);
1125 struct ubifs_info *c = dir->i_sb->s_fs_info; 1125 struct ubifs_info *c = dir->i_sb->s_fs_info;
1126 int err, len = strlen(symname); 1126 int err, sz_change, len = strlen(symname);
1127 int sz_change = CALC_DENT_SIZE(len);
1128 struct fscrypt_str disk_link; 1127 struct fscrypt_str disk_link;
1129 struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1, 1128 struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
1130 .new_ino_d = ALIGN(len, 8), 1129 .new_ino_d = ALIGN(len, 8),
@@ -1151,6 +1150,8 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
1151 if (err) 1150 if (err)
1152 goto out_budg; 1151 goto out_budg;
1153 1152
1153 sz_change = CALC_DENT_SIZE(fname_len(&nm));
1154
1154 inode = ubifs_new_inode(c, dir, S_IFLNK | S_IRWXUGO); 1155 inode = ubifs_new_inode(c, dir, S_IFLNK | S_IRWXUGO);
1155 if (IS_ERR(inode)) { 1156 if (IS_ERR(inode)) {
1156 err = PTR_ERR(inode); 1157 err = PTR_ERR(inode);