From: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
Christophe Lombard <christophe_lombard@fr.ibm.com>,
Philippe Bergheaud <philippe.bergheaud@fr.ibm.com>
Cc: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>,
Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
"Alastair D'Silva" <alastair@linux.ibm.com>,
Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Subject: [PATCH 2/2] powerpc: Do not assign thread.tidr if already assigned
Date: Thu, 23 Nov 2017 18:17:18 +0530 [thread overview]
Message-ID: <20171123124718.16839-2-vaibhav@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171123124718.16839-1-vaibhav@linux.vnet.ibm.com>
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@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
next prev parent reply other threads:[~2017-11-23 12:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 12:47 [PATCH 1/2] powerpc: Avoid signed to unsigned conversion in set_thread_tidr() Vaibhav Jain
2017-11-23 12:47 ` Vaibhav Jain [this message]
2017-11-24 6:17 ` Michael Ellerman
2017-11-24 7:08 ` Vaibhav Jain
2017-11-27 3:44 ` Michael Ellerman
2017-11-27 17:05 ` Vaibhav Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171123124718.16839-2-vaibhav@linux.vnet.ibm.com \
--to=vaibhav@linux.vnet.ibm.com \
--cc=alastair@linux.ibm.com \
--cc=andrew.donnellan@au1.ibm.com \
--cc=christophe_lombard@fr.ibm.com \
--cc=fbarrat@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=philippe.bergheaud@fr.ibm.com \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).