Skip to content

Commit 843741c

Browse files
ubifs: Fix xattr_names length in exit paths
When the operation fails we also have to undo the changes we made to ->xattr_names. Otherwise listxattr() will report wrong lengths. Cc: stable@vger.kernel.org Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 390975a commit 843741c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ubifs/xattr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
172172
host_ui->xattr_cnt -= 1;
173173
host_ui->xattr_size -= CALC_DENT_SIZE(nm->len);
174174
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
175+
host_ui->xattr_names -= nm->len;
175176
mutex_unlock(&host_ui->ui_mutex);
176177
out_free:
177178
make_bad_inode(inode);
@@ -478,6 +479,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
478479
host_ui->xattr_cnt += 1;
479480
host_ui->xattr_size += CALC_DENT_SIZE(nm->len);
480481
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
482+
host_ui->xattr_names += nm->len;
481483
mutex_unlock(&host_ui->ui_mutex);
482484
ubifs_release_budget(c, &req);
483485
make_bad_inode(inode);

0 commit comments

Comments
 (0)