Skip to content

Commit

Permalink
powerpc: Do not assign thread.tidr if already assigned
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vaibhav Jain authored and Michael Ellerman committed Nov 29, 2017
1 parent aca7573 commit 7e4d423
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,9 @@ int set_thread_tidr(struct task_struct *t)
if (t != current)
return -EINVAL;

if (t->thread.tidr)
return 0;

rc = assign_thread_tidr();
if (rc < 0)
return rc;
Expand Down

0 comments on commit 7e4d423

Please sign in to comment.