Skip to content

Commit 7e4d423

Browse files
vaibhav92mpe
authored andcommitted
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: ec233ed("powerpc: Add support for setting SPRN_TIDR") Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> [mpe: Modify to return 0 in the success case, not the TID value] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent aca7573 commit 7e4d423

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/powerpc/kernel/process.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,9 @@ int set_thread_tidr(struct task_struct *t)
15771577
if (t != current)
15781578
return -EINVAL;
15791579

1580+
if (t->thread.tidr)
1581+
return 0;
1582+
15801583
rc = assign_thread_tidr();
15811584
if (rc < 0)
15821585
return rc;

0 commit comments

Comments
 (0)