diff options
author | James Morris <jmorris@namei.org> | 2008-11-13 19:29:12 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 19:29:12 -0500 |
commit | 2b828925652340277a889cbc11b2d0637f7cdaf7 (patch) | |
tree | 32fcb3d3e466fc419fad2d3717956a5b5ad3d35a /net/core/scm.c | |
parent | 3a3b7ce9336952ea7b9564d976d068a238976c9d (diff) | |
parent | 58e20d8d344b0ee083febb18c2b021d2427e56ca (diff) |
Merge branch 'master' into next
Conflicts:
security/keys/internal.h
security/keys/process_keys.c
security/keys/request_key.c
Fixed conflicts above by using the non 'tsk' versions.
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'net/core/scm.c')
-rw-r--r-- | net/core/scm.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/net/core/scm.c b/net/core/scm.c index f73c44b17dda..1e17949c12ca 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -77,6 +77,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
77 | if (!fpl) | 77 | if (!fpl) |
78 | return -ENOMEM; | 78 | return -ENOMEM; |
79 | *fplp = fpl; | 79 | *fplp = fpl; |
80 | INIT_LIST_HEAD(&fpl->list); | ||
80 | fpl->count = 0; | 81 | fpl->count = 0; |
81 | } | 82 | } |
82 | fpp = &fpl->fp[fpl->count]; | 83 | fpp = &fpl->fp[fpl->count]; |
@@ -108,9 +109,25 @@ void __scm_destroy(struct scm_cookie *scm) | |||
108 | 109 | ||
109 | if (fpl) { | 110 | if (fpl) { |
110 | scm->fp = NULL; | 111 | scm->fp = NULL; |
111 | for (i=fpl->count-1; i>=0; i--) | 112 | if (current->scm_work_list) { |
112 | fput(fpl->fp[i]); | 113 | list_add_tail(&fpl->list, current->scm_work_list); |
113 | kfree(fpl); | 114 | } else { |
115 | LIST_HEAD(work_list); | ||
116 | |||
117 | current->scm_work_list = &work_list; | ||
118 | |||
119 | list_add(&fpl->list, &work_list); | ||
120 | while (!list_empty(&work_list)) { | ||
121 | fpl = list_first_entry(&work_list, struct scm_fp_list, list); | ||
122 | |||
123 | list_del(&fpl->list); | ||
124 | for (i=fpl->count-1; i>=0; i--) | ||
125 | fput(fpl->fp[i]); | ||
126 | kfree(fpl); | ||
127 | } | ||
128 | |||
129 | current->scm_work_list = NULL; | ||
130 | } | ||
114 | } | 131 | } |
115 | } | 132 | } |
116 | 133 | ||
@@ -286,6 +303,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) | |||
286 | 303 | ||
287 | new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); | 304 | new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); |
288 | if (new_fpl) { | 305 | if (new_fpl) { |
306 | INIT_LIST_HEAD(&new_fpl->list); | ||
289 | for (i=fpl->count-1; i>=0; i--) | 307 | for (i=fpl->count-1; i>=0; i--) |
290 | get_file(fpl->fp[i]); | 308 | get_file(fpl->fp[i]); |
291 | memcpy(new_fpl, fpl, sizeof(*fpl)); | 309 | memcpy(new_fpl, fpl, sizeof(*fpl)); |