summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Peiffer <pierre.peiffer@stericsson.com>2011-10-20 13:09:01 +0200
committerJonas ABERG <jonas.aberg@stericsson.com>2011-10-27 16:23:55 +0200
commit1e0a8ea7125e157799d3581ecfbe88462e93713b (patch)
treee35293a65799e5fd9186a1ceab4634ad8fe3741f
parent6799091f33fa5616fcd7f715be1c7c8849dfa78b (diff)
U8500 CM: fix re-entrancy issue
Fix a re-entrancy issue when killing two processes that use the CM driver simultaneously. ST-Ericsson ID: 364585 ST-Ericsson Linux next: NA ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I48cb434b87a85b635fe4506a92d7b1c7086071fb Signed-off-by: Pierre Peiffer <pierre.peiffer@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/35216 Reviewed-by: QATOOLS Reviewed-by: QABUILD
-rw-r--r--drivers/staging/nmf-cm/cmld.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/nmf-cm/cmld.c b/drivers/staging/nmf-cm/cmld.c
index d96ceaa3fe5..925ce038862 100644
--- a/drivers/staging/nmf-cm/cmld.c
+++ b/drivers/staging/nmf-cm/cmld.c
@@ -165,16 +165,15 @@ static inline void freeChannels(struct cm_process_priv* processPriv)
{
struct list_head* head, *next;
int warn = 0;
-
+
+ mutex_lock(&channel_lock);
list_for_each_safe(head, next, &channel_list) {
struct cm_channel_priv *channelPriv;
channelPriv = list_entry(head, struct cm_channel_priv, entry);
/* Only channels belonging to this process are concerned */
if (channelPriv->proc == processPriv) {
tasklet_disable(&cmld_service_tasklet);
- mutex_lock(&channel_lock);
list_del(&channelPriv->entry);
- mutex_unlock(&channel_lock);
tasklet_enable(&cmld_service_tasklet);
/* Free all remaining messages if any
@@ -190,6 +189,8 @@ static inline void freeChannels(struct cm_process_priv* processPriv)
}
warn = 1;
}
+ mutex_unlock(&channel_lock);
+
if (warn)
pr_err("[CM - PID=%d]: Some remaining channel entries "
"freed\n", current->tgid);