Commit 0eba8697 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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
parents 211b100a f061c1cc
...@@ -1912,7 +1912,9 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) ...@@ -1912,7 +1912,9 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
mutex_unlock(&c->bu_mutex); 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; return 0;
} }
...@@ -1954,6 +1956,9 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) ...@@ -1954,6 +1956,9 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
int dev, vol; int dev, vol;
char *endptr; char *endptr;
if (!name || !*name)
return ERR_PTR(-EINVAL);
/* First, try to open using the device node path method */ /* First, try to open using the device node path method */
ubi = ubi_open_volume_path(name, mode); ubi = ubi_open_volume_path(name, mode);
if (!IS_ERR(ubi)) if (!IS_ERR(ubi))
......
...@@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, ...@@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
ui->data_len = size; ui->data_len = size;
mutex_lock(&host_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->i_ctime = current_time(host);
host_ui->xattr_cnt += 1; host_ui->xattr_cnt += 1;
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); 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, ...@@ -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_size -= CALC_XATTR_BYTES(size);
host_ui->xattr_names -= fname_len(nm); host_ui->xattr_names -= fname_len(nm);
host_ui->flags &= ~UBIFS_CRYPT_FL; host_ui->flags &= ~UBIFS_CRYPT_FL;
out_noent:
mutex_unlock(&host_ui->ui_mutex); mutex_unlock(&host_ui->ui_mutex);
out_free: out_free:
make_bad_inode(inode); make_bad_inode(inode);
...@@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host, ...@@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
mutex_unlock(&ui->ui_mutex); mutex_unlock(&ui->ui_mutex);
mutex_lock(&host_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->i_ctime = current_time(host);
host_ui->xattr_size -= CALC_XATTR_BYTES(old_size); host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
host_ui->xattr_size += CALC_XATTR_BYTES(size); host_ui->xattr_size += CALC_XATTR_BYTES(size);
...@@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host, ...@@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
out_cancel: out_cancel:
host_ui->xattr_size -= CALC_XATTR_BYTES(size); host_ui->xattr_size -= CALC_XATTR_BYTES(size);
host_ui->xattr_size += CALC_XATTR_BYTES(old_size); host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
out_noent:
mutex_unlock(&host_ui->ui_mutex); mutex_unlock(&host_ui->ui_mutex);
make_bad_inode(inode); make_bad_inode(inode);
out_free: out_free:
...@@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host, ...@@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
return err; return err;
mutex_lock(&host_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->i_ctime = current_time(host);
host_ui->xattr_cnt -= 1; host_ui->xattr_cnt -= 1;
host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm)); 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, ...@@ -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_DENT_SIZE(fname_len(nm));
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len); host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
host_ui->xattr_names += fname_len(nm); host_ui->xattr_names += fname_len(nm);
out_noent:
mutex_unlock(&host_ui->ui_mutex); mutex_unlock(&host_ui->ui_mutex);
ubifs_release_budget(c, &req); ubifs_release_budget(c, &req);
make_bad_inode(inode); make_bad_inode(inode);
...@@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name) ...@@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
ubifs_assert(c, inode_is_locked(host)); ubifs_assert(c, inode_is_locked(host));
if (!host->i_nlink)
return -ENOENT;
if (fname_len(&nm) > UBIFS_MAX_NLEN) if (fname_len(&nm) > UBIFS_MAX_NLEN)
return -ENAMETOOLONG; return -ENAMETOOLONG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment