diff options
author | Pierre Peiffer <pierre.peiffer@stericsson.com> | 2011-07-18 18:29:14 +0200 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-03-19 09:02:19 +0100 |
commit | 3f4e102901beba5e65e1bd355434a577a928f088 (patch) | |
tree | 276ecb5e5ac32d69704dbcf0eec0186bd8bcf3a9 | |
parent | 7da772232688eaf36a1700b6ad7be3145e10fe4a (diff) |
U8500 NMF-CM: make creation of domains more robust
CM_ENGINE_CreateMemoryDomain() allows the creation of
domains for some other client (process ID).
Today, it doesn't check the existance of the target client,
what can lead to an unused domain.
This patch fixes it for forbidding the creation of domain
for a non-existing client.
ST-Ericsson ID: 352761
ST-Ericsson Linux next: -
ST-Ericsson FOSS-OUT ID: Trivial
Signed-off-by: Pierre Peiffer <pierre.peiffer@stericsson.com>
Change-Id: Icf81e9a9c18ce204d0f3c472a1ee05b140567738
-rw-r--r-- | drivers/staging/nmf-cm/cm_syscall.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/staging/nmf-cm/cm_syscall.c b/drivers/staging/nmf-cm/cm_syscall.c index f4be2c2d3d1..a687e0206a3 100644 --- a/drivers/staging/nmf-cm/cm_syscall.c +++ b/drivers/staging/nmf-cm/cm_syscall.c @@ -514,10 +514,25 @@ inline int cmld_CreateMemoryDomain(struct cm_process_priv *procPriv, data.out.error = CM_ENGINE_CreateMemoryDomain(procPriv->pid, &domain, &data.out.handle); - else - data.out.error = CM_ENGINE_CreateMemoryDomain(data.in.client, - &domain, - &data.out.handle); + else { + /* Check if client is valid (ie already registered) */ + struct list_head* head; + struct cm_process_priv *entry; + + list_for_each(head, &process_list) { + entry = list_entry(head, struct cm_process_priv, + entry); + if (entry->pid == data.in.client) + break; + } + if (head == &process_list) + data.out.error = CM_INVALID_PARAMETER; + else + data.out.error = + CM_ENGINE_CreateMemoryDomain(data.in.client, + &domain, + &data.out.handle); + } /* Copy results back to userspace */ if (copy_to_user(¶m->out, &data.out, sizeof(data.out))) |