Skip to content

Commit 0eba869

Browse files
committed
Merge tag 'upstream-4.19-rc4' of git://git.infradead.org/linux-ubifs
Richard writes: "This pull request contains fixes for UBIFS: - A wrong UBIFS assertion in mount code - Fix for a NULL pointer deref in mount code - Revert of a bad fix for xattrs" * tag 'upstream-4.19-rc4' of git://git.infradead.org/linux-ubifs: Revert "ubifs: xattr: Don't operate on deleted inodes" ubifs: drop false positive assertion ubifs: Check for name being NULL while mounting
2 parents 211b100 + f061c1c commit 0eba869

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

fs/ubifs/super.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,9 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
19121912
mutex_unlock(&c->bu_mutex);
19131913
}
19141914

1915-
ubifs_assert(c, c->lst.taken_empty_lebs > 0);
1915+
if (!c->need_recovery)
1916+
ubifs_assert(c, c->lst.taken_empty_lebs > 0);
1917+
19161918
return 0;
19171919
}
19181920

@@ -1954,6 +1956,9 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
19541956
int dev, vol;
19551957
char *endptr;
19561958

1959+
if (!name || !*name)
1960+
return ERR_PTR(-EINVAL);
1961+
19571962
/* First, try to open using the device node path method */
19581963
ubi = ubi_open_volume_path(name, mode);
19591964
if (!IS_ERR(ubi))

fs/ubifs/xattr.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
152152
ui->data_len = size;
153153

154154
mutex_lock(&host_ui->ui_mutex);
155-
156-
if (!host->i_nlink) {
157-
err = -ENOENT;
158-
goto out_noent;
159-
}
160-
161155
host->i_ctime = current_time(host);
162156
host_ui->xattr_cnt += 1;
163157
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
@@ -190,7 +184,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
190184
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
191185
host_ui->xattr_names -= fname_len(nm);
192186
host_ui->flags &= ~UBIFS_CRYPT_FL;
193-
out_noent:
194187
mutex_unlock(&host_ui->ui_mutex);
195188
out_free:
196189
make_bad_inode(inode);
@@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
242235
mutex_unlock(&ui->ui_mutex);
243236

244237
mutex_lock(&host_ui->ui_mutex);
245-
246-
if (!host->i_nlink) {
247-
err = -ENOENT;
248-
goto out_noent;
249-
}
250-
251238
host->i_ctime = current_time(host);
252239
host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
253240
host_ui->xattr_size += CALC_XATTR_BYTES(size);
@@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
269256
out_cancel:
270257
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
271258
host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
272-
out_noent:
273259
mutex_unlock(&host_ui->ui_mutex);
274260
make_bad_inode(inode);
275261
out_free:
@@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
496482
return err;
497483

498484
mutex_lock(&host_ui->ui_mutex);
499-
500-
if (!host->i_nlink) {
501-
err = -ENOENT;
502-
goto out_noent;
503-
}
504-
505485
host->i_ctime = current_time(host);
506486
host_ui->xattr_cnt -= 1;
507487
host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
@@ -521,7 +501,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
521501
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
522502
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
523503
host_ui->xattr_names += fname_len(nm);
524-
out_noent:
525504
mutex_unlock(&host_ui->ui_mutex);
526505
ubifs_release_budget(c, &req);
527506
make_bad_inode(inode);
@@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
561540

562541
ubifs_assert(c, inode_is_locked(host));
563542

564-
if (!host->i_nlink)
565-
return -ENOENT;
566-
567543
if (fname_len(&nm) > UBIFS_MAX_NLEN)
568544
return -ENAMETOOLONG;
569545

0 commit comments

Comments
 (0)