提交 7e4d4233 编写于 作者: V Vaibhav Jain 提交者: Michael Ellerman

powerpc: Do not assign thread.tidr if already assigned

If set_thread_tidr() is called twice for same task_struct then it will
allocate 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() to check if a tidr
value is already assigned to the task_struct and if yes then returns
zero.

Fixes: ec233ede("powerpc: Add support for setting SPRN_TIDR")
Signed-off-by: NVaibhav Jain <vaibhav@linux.vnet.ibm.com>
Reviewed-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
[mpe: Modify to return 0 in the success case, not the TID value]
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 aca7573f
...@@ -1577,6 +1577,9 @@ int set_thread_tidr(struct task_struct *t) ...@@ -1577,6 +1577,9 @@ int set_thread_tidr(struct task_struct *t)
if (t != current) if (t != current)
return -EINVAL; return -EINVAL;
if (t->thread.tidr)
return 0;
rc = assign_thread_tidr(); rc = assign_thread_tidr();
if (rc < 0) if (rc < 0)
return rc; return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册