Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-5.10-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull more ubi and ubifs updates from Richard Weinberger:
"UBI:
- Correctly use kthread_should_stop in ubi worker

UBIFS:
- Fixes for memory leaks while iterating directory entries
- Fix for a user triggerable error message
- Fix for a space accounting bug in authenticated mode"

* tag 'for-linus-5.10-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
ubifs: journal: Make sure to not dirty twice for auth nodes
ubifs: setflags: Don't show error message when vfs_ioc_setflags_prepare() fails
ubifs: ubifs_jnl_change_xattr: Remove assertion 'nlink > 0' for host inode
ubi: check kthread_should_stop() after the setting of task state
ubifs: dent: Fix some potential memory leaks while iterating entries
ubifs: xattr: Fix some potential memory leaks while iterating entries

+25 -4
+13
drivers/mtd/ubi/wl.c
··· 1639 1639 !ubi->thread_enabled || ubi_dbg_is_bgt_disabled(ubi)) { 1640 1640 set_current_state(TASK_INTERRUPTIBLE); 1641 1641 spin_unlock(&ubi->wl_lock); 1642 + 1643 + /* 1644 + * Check kthread_should_stop() after we set the task 1645 + * state to guarantee that we either see the stop bit 1646 + * and exit or the task state is reset to runnable such 1647 + * that it's not scheduled out indefinitely and detects 1648 + * the stop bit at kthread_should_stop(). 1649 + */ 1650 + if (kthread_should_stop()) { 1651 + set_current_state(TASK_RUNNING); 1652 + break; 1653 + } 1654 + 1642 1655 schedule(); 1643 1656 continue; 1644 1657 }
+1
fs/ubifs/debug.c
··· 1123 1123 err = PTR_ERR(dent); 1124 1124 if (err == -ENOENT) 1125 1125 break; 1126 + kfree(pdent); 1126 1127 return err; 1127 1128 } 1128 1129
-1
fs/ubifs/ioctl.c
··· 134 134 return err; 135 135 136 136 out_unlock: 137 - ubifs_err(c, "can't modify inode %lu attributes", inode->i_ino); 138 137 mutex_unlock(&ui->ui_mutex); 139 138 ubifs_release_budget(c, &req); 140 139 return err;
+4 -3
fs/ubifs/journal.c
··· 894 894 if (err == -ENOENT) 895 895 break; 896 896 897 + kfree(pxent); 897 898 goto out_release; 898 899 } 899 900 ··· 907 906 ubifs_err(c, "dead directory entry '%s', error %d", 908 907 xent->name, err); 909 908 ubifs_ro_mode(c, err); 909 + kfree(pxent); 910 910 kfree(xent); 911 911 goto out_release; 912 912 } ··· 938 936 inode->i_ino); 939 937 release_head(c, BASEHD); 940 938 941 - ubifs_add_auth_dirt(c, lnum); 942 - 943 939 if (last_reference) { 944 940 err = ubifs_tnc_remove_ino(c, inode->i_ino); 945 941 if (err) ··· 946 946 err = ubifs_add_dirt(c, lnum, write_len); 947 947 } else { 948 948 union ubifs_key key; 949 + 950 + ubifs_add_auth_dirt(c, lnum); 949 951 950 952 ino_key_init(c, &key, inode->i_ino); 951 953 err = ubifs_tnc_add(c, &key, lnum, offs, ilen, hash); ··· 1800 1798 u8 hash[UBIFS_HASH_ARR_SZ]; 1801 1799 1802 1800 dbg_jnl("ino %lu, ino %lu", host->i_ino, inode->i_ino); 1803 - ubifs_assert(c, host->i_nlink > 0); 1804 1801 ubifs_assert(c, inode->i_nlink > 0); 1805 1802 ubifs_assert(c, mutex_is_locked(&host_ui->ui_mutex)); 1806 1803
+2
fs/ubifs/orphan.c
··· 173 173 err = PTR_ERR(xent); 174 174 if (err == -ENOENT) 175 175 break; 176 + kfree(pxent); 176 177 return err; 177 178 } 178 179 ··· 183 182 184 183 xattr_orphan = orphan_add(c, xattr_inum, orphan); 185 184 if (IS_ERR(xattr_orphan)) { 185 + kfree(pxent); 186 186 kfree(xent); 187 187 return PTR_ERR(xattr_orphan); 188 188 }
+3
fs/ubifs/tnc.c
··· 2884 2884 err = PTR_ERR(xent); 2885 2885 if (err == -ENOENT) 2886 2886 break; 2887 + kfree(pxent); 2887 2888 return err; 2888 2889 } 2889 2890 ··· 2898 2897 fname_len(&nm) = le16_to_cpu(xent->nlen); 2899 2898 err = ubifs_tnc_remove_nm(c, &key1, &nm); 2900 2899 if (err) { 2900 + kfree(pxent); 2901 2901 kfree(xent); 2902 2902 return err; 2903 2903 } ··· 2907 2905 highest_ino_key(c, &key2, xattr_inum); 2908 2906 err = ubifs_tnc_remove_range(c, &key1, &key2); 2909 2907 if (err) { 2908 + kfree(pxent); 2910 2909 kfree(xent); 2911 2910 return err; 2912 2911 }
+2
fs/ubifs/xattr.c
··· 522 522 xent->name, err); 523 523 ubifs_ro_mode(c, err); 524 524 kfree(pxent); 525 + kfree(xent); 525 526 return err; 526 527 } 527 528 ··· 532 531 err = remove_xattr(c, host, xino, &nm); 533 532 if (err) { 534 533 kfree(pxent); 534 + kfree(xent); 535 535 iput(xino); 536 536 ubifs_err(c, "cannot remove xattr, error %d", err); 537 537 return err;