This pull request contains fixes for UBI and UBIFS
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 -----BEGIN PGP SIGNATURE----- iQJKBAABCAA0FiEEdgfidid8lnn52cLTZvlZhesYu8EFAl+LRl4WHHJpY2hhcmRA c2lnbWEtc3Rhci5hdAAKCRBm+VmF6xi7wVvTD/0ffSK9y4oECcW1/+84oHb5515g 5/CxYf5zalruOXWzA55OxI55BL18e1tnS26jT1G79BpNoitPLbqh/OhvDVtHUqEI 4Chd9PdeFb33GFubElcTviIBsGKMD2eYK5AVTX6fXxxRG8+UxT0u9T+1GXZGzlHA 0N3qWBuDhAlrh65UtORulpBOAexLymbSeINS7ibTXKqo3+sc70xjFZYTyt9Tr9np q2VVI+SS019A30RrIzfeaSpyfDZ1tdh5vhfsm6eGbearHpUrX6OZgFUQglRCF7DS bMTTODH+feJAPyknd9T1EdXrVNjzX24i1V3/wM8hC7qUZfaf1ZHeCuu0t353iiGn dXg+qA/v+AKTYh71MRfHd8GJvmKHospdhze1K5IIvA+lL6+bRwur88KVF8PwyaB7 KHRAghKLEdVBb68MzwF0ChbFSUDk6VTZdvj0FB1LO/h3YQ1I2Dp1Z946qjJm9bWF biATqHmR1hSPAyAP/VUGCdRqlwpuox5cUgoa7SwO3zP1aqBRG29Wsg1JJuqy74GN Dcov5vIhVly/zns6tKaHFleTeAMBO7e1fhEjg4TuMpzWt9v8eYnacWwR1Hfvm9VO +0rox1g5mDX/ZzPE/Koj3LFnr8JV8g0DPs0Uemz3D89xt3ftO0Du3NZSd8WgOcbS mZcpgTakNv2/DbTiGA== =RD+h -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
429731277d
|
@ -1639,6 +1639,19 @@ int ubi_thread(void *u)
|
||||||
!ubi->thread_enabled || ubi_dbg_is_bgt_disabled(ubi)) {
|
!ubi->thread_enabled || ubi_dbg_is_bgt_disabled(ubi)) {
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
spin_unlock(&ubi->wl_lock);
|
spin_unlock(&ubi->wl_lock);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check kthread_should_stop() after we set the task
|
||||||
|
* state to guarantee that we either see the stop bit
|
||||||
|
* and exit or the task state is reset to runnable such
|
||||||
|
* that it's not scheduled out indefinitely and detects
|
||||||
|
* the stop bit at kthread_should_stop().
|
||||||
|
*/
|
||||||
|
if (kthread_should_stop()) {
|
||||||
|
set_current_state(TASK_RUNNING);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
schedule();
|
schedule();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1123,6 +1123,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir)
|
||||||
err = PTR_ERR(dent);
|
err = PTR_ERR(dent);
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
break;
|
break;
|
||||||
|
kfree(pdent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,6 @@ static int setflags(struct inode *inode, int flags)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
ubifs_err(c, "can't modify inode %lu attributes", inode->i_ino);
|
|
||||||
mutex_unlock(&ui->ui_mutex);
|
mutex_unlock(&ui->ui_mutex);
|
||||||
ubifs_release_budget(c, &req);
|
ubifs_release_budget(c, &req);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -894,6 +894,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
kfree(pxent);
|
||||||
goto out_release;
|
goto out_release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,6 +907,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
|
||||||
ubifs_err(c, "dead directory entry '%s', error %d",
|
ubifs_err(c, "dead directory entry '%s', error %d",
|
||||||
xent->name, err);
|
xent->name, err);
|
||||||
ubifs_ro_mode(c, err);
|
ubifs_ro_mode(c, err);
|
||||||
|
kfree(pxent);
|
||||||
kfree(xent);
|
kfree(xent);
|
||||||
goto out_release;
|
goto out_release;
|
||||||
}
|
}
|
||||||
|
@ -936,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
|
||||||
inode->i_ino);
|
inode->i_ino);
|
||||||
release_head(c, BASEHD);
|
release_head(c, BASEHD);
|
||||||
|
|
||||||
ubifs_add_auth_dirt(c, lnum);
|
|
||||||
|
|
||||||
if (last_reference) {
|
if (last_reference) {
|
||||||
err = ubifs_tnc_remove_ino(c, inode->i_ino);
|
err = ubifs_tnc_remove_ino(c, inode->i_ino);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -947,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
|
||||||
} else {
|
} else {
|
||||||
union ubifs_key key;
|
union ubifs_key key;
|
||||||
|
|
||||||
|
ubifs_add_auth_dirt(c, lnum);
|
||||||
|
|
||||||
ino_key_init(c, &key, inode->i_ino);
|
ino_key_init(c, &key, inode->i_ino);
|
||||||
err = ubifs_tnc_add(c, &key, lnum, offs, ilen, hash);
|
err = ubifs_tnc_add(c, &key, lnum, offs, ilen, hash);
|
||||||
}
|
}
|
||||||
|
@ -1798,7 +1800,6 @@ int ubifs_jnl_change_xattr(struct ubifs_info *c, const struct inode *inode,
|
||||||
u8 hash[UBIFS_HASH_ARR_SZ];
|
u8 hash[UBIFS_HASH_ARR_SZ];
|
||||||
|
|
||||||
dbg_jnl("ino %lu, ino %lu", host->i_ino, inode->i_ino);
|
dbg_jnl("ino %lu, ino %lu", host->i_ino, inode->i_ino);
|
||||||
ubifs_assert(c, host->i_nlink > 0);
|
|
||||||
ubifs_assert(c, inode->i_nlink > 0);
|
ubifs_assert(c, inode->i_nlink > 0);
|
||||||
ubifs_assert(c, mutex_is_locked(&host_ui->ui_mutex));
|
ubifs_assert(c, mutex_is_locked(&host_ui->ui_mutex));
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum)
|
||||||
err = PTR_ERR(xent);
|
err = PTR_ERR(xent);
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
break;
|
break;
|
||||||
|
kfree(pxent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,6 +183,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum)
|
||||||
|
|
||||||
xattr_orphan = orphan_add(c, xattr_inum, orphan);
|
xattr_orphan = orphan_add(c, xattr_inum, orphan);
|
||||||
if (IS_ERR(xattr_orphan)) {
|
if (IS_ERR(xattr_orphan)) {
|
||||||
|
kfree(pxent);
|
||||||
kfree(xent);
|
kfree(xent);
|
||||||
return PTR_ERR(xattr_orphan);
|
return PTR_ERR(xattr_orphan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2884,6 +2884,7 @@ int ubifs_tnc_remove_ino(struct ubifs_info *c, ino_t inum)
|
||||||
err = PTR_ERR(xent);
|
err = PTR_ERR(xent);
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
break;
|
break;
|
||||||
|
kfree(pxent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2897,6 +2898,7 @@ int ubifs_tnc_remove_ino(struct ubifs_info *c, ino_t inum)
|
||||||
fname_len(&nm) = le16_to_cpu(xent->nlen);
|
fname_len(&nm) = le16_to_cpu(xent->nlen);
|
||||||
err = ubifs_tnc_remove_nm(c, &key1, &nm);
|
err = ubifs_tnc_remove_nm(c, &key1, &nm);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
kfree(pxent);
|
||||||
kfree(xent);
|
kfree(xent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -2905,6 +2907,7 @@ int ubifs_tnc_remove_ino(struct ubifs_info *c, ino_t inum)
|
||||||
highest_ino_key(c, &key2, xattr_inum);
|
highest_ino_key(c, &key2, xattr_inum);
|
||||||
err = ubifs_tnc_remove_range(c, &key1, &key2);
|
err = ubifs_tnc_remove_range(c, &key1, &key2);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
kfree(pxent);
|
||||||
kfree(xent);
|
kfree(xent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,6 +522,7 @@ int ubifs_purge_xattrs(struct inode *host)
|
||||||
xent->name, err);
|
xent->name, err);
|
||||||
ubifs_ro_mode(c, err);
|
ubifs_ro_mode(c, err);
|
||||||
kfree(pxent);
|
kfree(pxent);
|
||||||
|
kfree(xent);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,6 +532,7 @@ int ubifs_purge_xattrs(struct inode *host)
|
||||||
err = remove_xattr(c, host, xino, &nm);
|
err = remove_xattr(c, host, xino, &nm);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree(pxent);
|
kfree(pxent);
|
||||||
|
kfree(xent);
|
||||||
iput(xino);
|
iput(xino);
|
||||||
ubifs_err(c, "cannot remove xattr, error %d", err);
|
ubifs_err(c, "cannot remove xattr, error %d", err);
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue