diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-08-20 22:46:05 -0400 |
---|---|---|
committer | Tyler Hicks <tyhicks@canonical.com> | 2012-12-18 11:07:29 -0500 |
commit | 8bbca57cff7f1b1fd046eebd1e9497a00161c2c1 (patch) | |
tree | 3fda3c058123baf9087b1a32922ad6498aff1e39 /fs | |
parent | e4bc6522d53b7b8eb02cfac35fd18275fd86269d (diff) |
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: 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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ecryptfs/kthread.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index 809e67d05ca3..f1ea610362c6 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void) | |||
102 | 102 | ||
103 | void ecryptfs_destroy_kthread(void) | 103 | void ecryptfs_destroy_kthread(void) |
104 | { | 104 | { |
105 | struct ecryptfs_open_req *req; | 105 | struct ecryptfs_open_req *req, *tmp; |
106 | 106 | ||
107 | mutex_lock(&ecryptfs_kthread_ctl.mux); | 107 | mutex_lock(&ecryptfs_kthread_ctl.mux); |
108 | ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; | 108 | ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; |
109 | list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, | 109 | list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list, |
110 | kthread_ctl_list) { | 110 | kthread_ctl_list) { |
111 | list_del(&req->kthread_ctl_list); | 111 | list_del(&req->kthread_ctl_list); |
112 | *req->lower_file = ERR_PTR(-EIO); | 112 | *req->lower_file = ERR_PTR(-EIO); |
113 | complete(&req->done); | 113 | complete(&req->done); |