[PATCH 2/2] powerpc: Do not assign thread.tidr if already assigned
Vaibhav Jain
vaibhav at linux.vnet.ibm.com
Thu Nov 23 23:47:18 AEDT 2017
If set_thread_tidr() is called twice for same task_struct then it will
allocated a new tidr value to it leaving the previous value still
dangling in the vas_thread_ida table.
To fix this the patch changes set_thread_tidr() checks if a tidr value
is already assigned to the task_struct and if yes then returns the
existing value from function instead of allocating a new one.
Fixes: ec233ede4c86("powerpc: Add support for setting SPRN_TIDR")
Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
---
arch/powerpc/kernel/process.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index a6eaf924c8b6..900193e4d6d8 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1577,6 +1577,9 @@ int set_thread_tidr(struct task_struct *t)
if (t != current)
return -EINVAL;
+ if (t->thread.tidr)
+ return t->thread.tidr;
+
rc = assign_thread_tidr();
if (rc > 0) {
t->thread.tidr = assign_thread_tidr();
--
2.14.3
More information about the Linuxppc-dev
mailing list