Skip to content

Commit

Permalink
ubifs: Fix xattr_names length in exit paths
Browse files Browse the repository at this point in the history
commit 843741c upstream.

When the operation fails we also have to undo the changes
we made to ->xattr_names. Otherwise listxattr() will report
wrong lengths.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
richardweinberger authored and gregkh committed Oct 28, 2016
1 parent 795422e commit d98a064
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ubifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
host_ui->xattr_cnt -= 1;
host_ui->xattr_size -= CALC_DENT_SIZE(nm->len);
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
host_ui->xattr_names -= nm->len;
mutex_unlock(&host_ui->ui_mutex);
out_free:
make_bad_inode(inode);
Expand Down Expand Up @@ -533,6 +534,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
host_ui->xattr_cnt += 1;
host_ui->xattr_size += CALC_DENT_SIZE(nm->len);
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
host_ui->xattr_names += nm->len;
mutex_unlock(&host_ui->ui_mutex);
ubifs_release_budget(c, &req);
make_bad_inode(inode);
Expand Down

0 comments on commit d98a064

Please sign in to comment.