]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
eCryptfs: fix to use list_for_each_entry_safe() when delete items
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 21 Aug 2012 02:46:05 +0000 (10:46 +0800)
committerTyler Hicks <tyhicks@canonical.com>
Tue, 18 Dec 2012 16:07:29 +0000 (10:07 -0600)
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
[tyhicks: Fixed compiler err - missing list_for_each_entry_safe() param]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
fs/ecryptfs/kthread.c

index 809e67d05ca34fa32eb1363c555db71757d1a6a7..f1ea610362c6c160a9d955c6a8e946da03b83ccb 100644 (file)
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void)
 
 void ecryptfs_destroy_kthread(void)
 {
-       struct ecryptfs_open_req *req;
+       struct ecryptfs_open_req *req, *tmp;
 
        mutex_lock(&ecryptfs_kthread_ctl.mux);
        ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
-       list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list,
-                           kthread_ctl_list) {
+       list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list,
+                                kthread_ctl_list) {
                list_del(&req->kthread_ctl_list);
                *req->lower_file = ERR_PTR(-EIO);
                complete(&req->done);