Skip to content

Commit

Permalink
Merge tag 'upstream-4.19-rc4' of git://git.infradead.org/linux-ubifs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gregkh committed Sep 21, 2018
2 parents 211b100 + f061c1c commit 0eba869
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
7 changes: 6 additions & 1 deletion fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,9 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
mutex_unlock(&c->bu_mutex);
}

ubifs_assert(c, c->lst.taken_empty_lebs > 0);
if (!c->need_recovery)
ubifs_assert(c, c->lst.taken_empty_lebs > 0);

return 0;
}

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

if (!name || !*name)
return ERR_PTR(-EINVAL);

/* First, try to open using the device node path method */
ubi = ubi_open_volume_path(name, mode);
if (!IS_ERR(ubi))
Expand Down
24 changes: 0 additions & 24 deletions fs/ubifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -190,7 +184,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);
Expand Down Expand Up @@ -242,12 +235,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);
Expand All @@ -269,7 +256,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:
Expand Down Expand Up @@ -496,12 +482,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));
Expand All @@ -521,7 +501,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);
Expand Down Expand Up @@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)

ubifs_assert(c, inode_is_locked(host));

if (!host->i_nlink)
return -ENOENT;

if (fname_len(&nm) > UBIFS_MAX_NLEN)
return -ENAMETOOLONG;

Expand Down

0 comments on commit 0eba869

Please sign in to comment.