Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bbca57c authored by Wei Yongjun's avatar Wei Yongjun Committed by Tyler Hicks
Browse files

eCryptfs: fix to use list_for_each_entry_safe() when delete items



Since we will be removing items off the list using list_del() we need
to use a safer version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe(). We should use the safe macro if the loop
involves deletions of items.

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
[tyhicks: Fixed compiler err - missing list_for_each_entry_safe() param]
Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
parent e4bc6522
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -102,11 +102,11 @@ int __init ecryptfs_init_kthread(void)


void ecryptfs_destroy_kthread(void)
void ecryptfs_destroy_kthread(void)
{
{
	struct ecryptfs_open_req *req;
	struct ecryptfs_open_req *req, *tmp;


	mutex_lock(&ecryptfs_kthread_ctl.mux);
	mutex_lock(&ecryptfs_kthread_ctl.mux);
	ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
	ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
	list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list,
	list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list,
				 kthread_ctl_list) {
				 kthread_ctl_list) {
		list_del(&req->kthread_ctl_list);
		list_del(&req->kthread_ctl_list);
		*req->lower_file = ERR_PTR(-EIO);
		*req->lower_file = ERR_PTR(-EIO);