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
Unified · Split
| @@ -1912,7 +1912,9 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) · 1911 unmodified lines | |||
| 1912 | mutex_unlock(&c->bu_mutex); | 1912 | mutex_unlock(&c->bu_mutex); |
| 1913 | } | 1913 | } |
| 1914 | 1914 | ||
| 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 | |||
| 1916 | return 0; | 1918 | return 0; |
| 1917 | } | 1919 | } |
| 1918 | 1920 | ||
| @@ -1954,6 +1956,9 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) · 35 unmodified lines | |||
| 1954 | int dev, vol; | 1956 | int dev, vol; |
| 1955 | char *endptr; | 1957 | char *endptr; |
| 1956 | 1958 | ||
| 1959 | if (!name || !*name) | ||
| 1960 | return ERR_PTR(-EINVAL); | ||
| 1961 | |||
| 1957 | /* First, try to open using the device node path method */ | 1962 | /* First, try to open using the device node path method */ |
| 1958 | ubi = ubi_open_volume_path(name, mode); | 1963 | ubi = ubi_open_volume_path(name, mode); |
| 1959 | if (!IS_ERR(ubi)) | 1964 | if (!IS_ERR(ubi)) |
| @@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, · 151 unmodified lines | |||
| 152 | ui->data_len = size; | 152 | ui->data_len = size; |
| 153 | 153 | ||
| 154 | mutex_lock(&host_ui->ui_mutex); | 154 | mutex_lock(&host_ui->ui_mutex); |
| 155 | |||
| 156 | if (!host->i_nlink) { | ||
| 157 | err = -ENOENT; | ||
| 158 | goto out_noent; | ||
| 159 | } | ||
| 160 | |||
| 161 | host->i_ctime = current_time(host); | 155 | host->i_ctime = current_time(host); |
| 162 | host_ui->xattr_cnt += 1; | 156 | host_ui->xattr_cnt += 1; |
| 163 | host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); | 157 | host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); |
| @@ -190,7 +184,6 @@ out_cancel: · 26 unmodified lines | |||
| 190 | host_ui->xattr_size -= CALC_XATTR_BYTES(size); | 184 | host_ui->xattr_size -= CALC_XATTR_BYTES(size); |
| 191 | host_ui->xattr_names -= fname_len(nm); | 185 | host_ui->xattr_names -= fname_len(nm); |
| 192 | host_ui->flags &= ~UBIFS_CRYPT_FL; | 186 | host_ui->flags &= ~UBIFS_CRYPT_FL; |
| 193 | out_noent: | ||
| 194 | mutex_unlock(&host_ui->ui_mutex); | 187 | mutex_unlock(&host_ui->ui_mutex); |
| 195 | out_free: | 188 | out_free: |
| 196 | make_bad_inode(inode); | 189 | make_bad_inode(inode); |
| @@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host, · 45 unmodified lines | |||
| 242 | mutex_unlock(&ui->ui_mutex); | 235 | mutex_unlock(&ui->ui_mutex); |
| 243 | 236 | ||
| 244 | mutex_lock(&host_ui->ui_mutex); | 237 | mutex_lock(&host_ui->ui_mutex); |
| 245 | |||
| 246 | if (!host->i_nlink) { | ||
| 247 | err = -ENOENT; | ||
| 248 | goto out_noent; | ||
| 249 | } | ||
| 250 | |||
| 251 | host->i_ctime = current_time(host); | 238 | host->i_ctime = current_time(host); |
| 252 | host_ui->xattr_size -= CALC_XATTR_BYTES(old_size); | 239 | host_ui->xattr_size -= CALC_XATTR_BYTES(old_size); |
| 253 | host_ui->xattr_size += CALC_XATTR_BYTES(size); | 240 | host_ui->xattr_size += CALC_XATTR_BYTES(size); |
| @@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host, · 15 unmodified lines | |||
| 269 | out_cancel: | 256 | out_cancel: |
| 270 | host_ui->xattr_size -= CALC_XATTR_BYTES(size); | 257 | host_ui->xattr_size -= CALC_XATTR_BYTES(size); |
| 271 | host_ui->xattr_size += CALC_XATTR_BYTES(old_size); | 258 | host_ui->xattr_size += CALC_XATTR_BYTES(old_size); |
| 272 | out_noent: | ||
| 273 | mutex_unlock(&host_ui->ui_mutex); | 259 | mutex_unlock(&host_ui->ui_mutex); |
| 274 | make_bad_inode(inode); | 260 | make_bad_inode(inode); |
| 275 | out_free: | 261 | out_free: |
| @@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host, · 220 unmodified lines | |||
| 496 | return err; | 482 | return err; |
| 497 | 483 | ||
| 498 | mutex_lock(&host_ui->ui_mutex); | 484 | mutex_lock(&host_ui->ui_mutex); |
| 499 | |||
| 500 | if (!host->i_nlink) { | ||
| 501 | err = -ENOENT; | ||
| 502 | goto out_noent; | ||
| 503 | } | ||
| 504 | |||
| 505 | host->i_ctime = current_time(host); | 485 | host->i_ctime = current_time(host); |
| 506 | host_ui->xattr_cnt -= 1; | 486 | host_ui->xattr_cnt -= 1; |
| 507 | host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm)); | 487 | host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm)); |
| @@ -521,7 +501,6 @@ out_cancel: · 13 unmodified lines | |||
| 521 | host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); | 501 | host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm)); |
| 522 | host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len); | 502 | host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len); |
| 523 | host_ui->xattr_names += fname_len(nm); | 503 | host_ui->xattr_names += fname_len(nm); |
| 524 | out_noent: | ||
| 525 | mutex_unlock(&host_ui->ui_mutex); | 504 | mutex_unlock(&host_ui->ui_mutex); |
| 526 | ubifs_release_budget(c, &req); | 505 | ubifs_release_budget(c, &req); |
| 527 | make_bad_inode(inode); | 506 | make_bad_inode(inode); |
| @@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name) · 33 unmodified lines | |||
| 561 | 540 | ||
| 562 | ubifs_assert(c, inode_is_locked(host)); | 541 | ubifs_assert(c, inode_is_locked(host)); |
| 563 | 542 | ||
| 564 | if (!host->i_nlink) | ||
| 565 | return -ENOENT; | ||
| 566 | |||
| 567 | if (fname_len(&nm) > UBIFS_MAX_NLEN) | 543 | if (fname_len(&nm) > UBIFS_MAX_NLEN) |
| 568 | return -ENAMETOOLONG; | 544 | return -ENAMETOOLONG; |
| 569 | 545 | ||