1 From f061c1cc404a618858a77aea233fde0aeaad2f2d Mon Sep 17 00:00:00 2001
2 From: Richard Weinberger <richard@nod.at>
3 Date: Sun, 16 Sep 2018 23:57:35 +0200
4 Subject: Revert "ubifs: xattr: Don't operate on deleted inodes"
6 From: Richard Weinberger <richard@nod.at>
8 commit f061c1cc404a618858a77aea233fde0aeaad2f2d upstream.
10 This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
11 UBIFS wants to assert that xattr operations are only issued on files
12 with positive link count. The said patch made this operations return
13 -ENOENT for unlinked files such that the asserts will no longer trigger.
14 This was wrong since xattr operations are perfectly fine on unlinked
16 Instead the assertions need to be fixed/removed.
18 Cc: <stable@vger.kernel.org>
19 Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
20 Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
21 Tested-by: Joel Stanley <joel@jms.id.au>
22 Signed-off-by: Richard Weinberger <richard@nod.at>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 fs/ubifs/xattr.c | 24 ------------------------
27 1 file changed, 24 deletions(-)
29 --- a/fs/ubifs/xattr.c
30 +++ b/fs/ubifs/xattr.c
31 @@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_inf
34 mutex_lock(&host_ui->ui_mutex);
36 - if (!host->i_nlink) {
41 host->i_ctime = current_time(host);
42 host_ui->xattr_cnt += 1;
43 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
44 @@ -190,7 +184,6 @@ out_cancel:
45 host_ui->xattr_size -= CALC_XATTR_BYTES(size);
46 host_ui->xattr_names -= fname_len(nm);
47 host_ui->flags &= ~UBIFS_CRYPT_FL;
49 mutex_unlock(&host_ui->ui_mutex);
51 make_bad_inode(inode);
52 @@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_inf
53 mutex_unlock(&ui->ui_mutex);
55 mutex_lock(&host_ui->ui_mutex);
57 - if (!host->i_nlink) {
62 host->i_ctime = current_time(host);
63 host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
64 host_ui->xattr_size += CALC_XATTR_BYTES(size);
65 @@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_inf
67 host_ui->xattr_size -= CALC_XATTR_BYTES(size);
68 host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
70 mutex_unlock(&host_ui->ui_mutex);
71 make_bad_inode(inode);
73 @@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_inf
76 mutex_lock(&host_ui->ui_mutex);
78 - if (!host->i_nlink) {
83 host->i_ctime = current_time(host);
84 host_ui->xattr_cnt -= 1;
85 host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
86 @@ -521,7 +501,6 @@ out_cancel:
87 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
88 host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
89 host_ui->xattr_names += fname_len(nm);
91 mutex_unlock(&host_ui->ui_mutex);
92 ubifs_release_budget(c, &req);
93 make_bad_inode(inode);
94 @@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct ino
96 ubifs_assert(inode_is_locked(host));
101 if (fname_len(&nm) > UBIFS_MAX_NLEN)
102 return -ENAMETOOLONG;