mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
Revert "ubifs: xattr: Don't operate on deleted inodes"
commitf061c1cc40
upstream. This reverts commit11a6fc3dc7
. UBIFS wants to assert that xattr operations are only issued on files with positive link count. The said patch made this operations return -ENOENT for unlinked files such that the asserts will no longer trigger. This was wrong since xattr operations are perfectly fine on unlinked files. Instead the assertions need to be fixed/removed. Cc: <stable@vger.kernel.org> Fixes:11a6fc3dc7
("ubifs: xattr: Don't operate on deleted inodes") Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
44383139a3
commit
1d7e23f906
1 changed files with 0 additions and 24 deletions
|
@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
|
|||
ui->data_len = size;
|
||||
|
||||
mutex_lock(&host_ui->ui_mutex);
|
||||
|
||||
if (!host->i_nlink) {
|
||||
err = -ENOENT;
|
||||
goto out_noent;
|
||||
}
|
||||
|
||||
host->i_ctime = current_time(host);
|
||||
host_ui->xattr_cnt += 1;
|
||||
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
|
||||
|
@ -189,7 +183,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
|
|||
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
|
||||
host_ui->xattr_names -= fname_len(nm);
|
||||
host_ui->flags &= ~UBIFS_CRYPT_FL;
|
||||
out_noent:
|
||||
mutex_unlock(&host_ui->ui_mutex);
|
||||
out_free:
|
||||
make_bad_inode(inode);
|
||||
|
@ -241,12 +234,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
|
|||
mutex_unlock(&ui->ui_mutex);
|
||||
|
||||
mutex_lock(&host_ui->ui_mutex);
|
||||
|
||||
if (!host->i_nlink) {
|
||||
err = -ENOENT;
|
||||
goto out_noent;
|
||||
}
|
||||
|
||||
host->i_ctime = current_time(host);
|
||||
host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
|
||||
host_ui->xattr_size += CALC_XATTR_BYTES(size);
|
||||
|
@ -268,7 +255,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
|
|||
out_cancel:
|
||||
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
|
||||
host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
|
||||
out_noent:
|
||||
mutex_unlock(&host_ui->ui_mutex);
|
||||
make_bad_inode(inode);
|
||||
out_free:
|
||||
|
@ -497,12 +483,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
|
|||
return err;
|
||||
|
||||
mutex_lock(&host_ui->ui_mutex);
|
||||
|
||||
if (!host->i_nlink) {
|
||||
err = -ENOENT;
|
||||
goto out_noent;
|
||||
}
|
||||
|
||||
host->i_ctime = current_time(host);
|
||||
host_ui->xattr_cnt -= 1;
|
||||
host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
|
||||
|
@ -522,7 +502,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
|
|||
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
|
||||
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
|
||||
host_ui->xattr_names += fname_len(nm);
|
||||
out_noent:
|
||||
mutex_unlock(&host_ui->ui_mutex);
|
||||
ubifs_release_budget(c, &req);
|
||||
make_bad_inode(inode);
|
||||
|
@ -562,9 +541,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
|
|||
|
||||
ubifs_assert(inode_is_locked(host));
|
||||
|
||||
if (!host->i_nlink)
|
||||
return -ENOENT;
|
||||
|
||||
if (fname_len(&nm) > UBIFS_MAX_NLEN)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
|
|
Loading…
Reference in a new issue