Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: src/tspi/rpc/hosttable.c

Issue 6813030: Avoid shutdown-time crash in wpa_supplicant. (Closed) Base URL: http://git.chromium.org/git/trousers.git@master
Patch Set: move code to right location Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Licensed Materials - Property of IBM 3 * Licensed Materials - Property of IBM
4 * 4 *
5 * trousers - An open source TCG Software Stack 5 * trousers - An open source TCG Software Stack
6 * 6 *
7 * (C) Copyright International Business Machines Corp. 2004 7 * (C) Copyright International Business Machines Corp. 2004
8 * 8 *
9 */ 9 */
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 MUTEX_UNLOCK(ht->lock); 153 MUTEX_UNLOCK(ht->lock);
154 } 154 }
155 155
156 struct host_table_entry * 156 struct host_table_entry *
157 get_table_entry(TSS_HCONTEXT tspContext) 157 get_table_entry(TSS_HCONTEXT tspContext)
158 { 158 {
159 struct host_table_entry *index = NULL; 159 struct host_table_entry *index = NULL;
160 160
161 /* Avoid shutdown race in wpa_supplicant */
162 if (ht == NULL)
163 return NULL;
164
161 MUTEX_LOCK(ht->lock); 165 MUTEX_LOCK(ht->lock);
162 166
163 for (index = ht->entries; index; index = index->next) { 167 for (index = ht->entries; index; index = index->next) {
164 if (index->tspContext == tspContext) 168 if (index->tspContext == tspContext)
165 break; 169 break;
166 } 170 }
167 171
168 if (index) 172 if (index)
169 MUTEX_LOCK(index->lock); 173 MUTEX_LOCK(index->lock);
170 174
171 MUTEX_UNLOCK(ht->lock); 175 MUTEX_UNLOCK(ht->lock);
172 176
173 return index; 177 return index;
174 } 178 }
175 179
176 void 180 void
177 put_table_entry(struct host_table_entry *entry) 181 put_table_entry(struct host_table_entry *entry)
178 { 182 {
179 if (entry) 183 if (entry)
180 MUTEX_UNLOCK(entry->lock); 184 MUTEX_UNLOCK(entry->lock);
181 } 185 }
182
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698