Skip to content

Commit 00ee8b6

Browse files
ubifs: Fix directory size calculation for symlinks
We have to account the name of the symlink and not the target length. Fixes: ca7f85b ("ubifs: Add support for encrypted symlinks") Cc: <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 94710ca commit 00ee8b6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/ubifs/dir.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
11231123
struct ubifs_inode *ui;
11241124
struct ubifs_inode *dir_ui = ubifs_inode(dir);
11251125
struct ubifs_info *c = dir->i_sb->s_fs_info;
1126-
int err, len = strlen(symname);
1127-
int sz_change = CALC_DENT_SIZE(len);
1126+
int err, sz_change, len = strlen(symname);
11281127
struct fscrypt_str disk_link;
11291128
struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
11301129
.new_ino_d = ALIGN(len, 8),
@@ -1151,6 +1150,8 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
11511150
if (err)
11521151
goto out_budg;
11531152

1153+
sz_change = CALC_DENT_SIZE(fname_len(&nm));
1154+
11541155
inode = ubifs_new_inode(c, dir, S_IFLNK | S_IRWXUGO);
11551156
if (IS_ERR(inode)) {
11561157
err = PTR_ERR(inode);

0 commit comments

Comments
 (0)