summaryrefslogtreecommitdiff
path: root/arch/sparc
diff options
context:
space:
mode:
authorJag Raman <jag.raman@oracle.com>2017-06-23 14:58:37 -0400
committerDavid S. Miller <davem@davemloft.net>2017-06-25 13:43:14 -0700
commit110f2264b37674e99057acd249a930040fad55b1 (patch)
treedfcd031ed4fb83a2c456c86e1b29d6c3f0d6587f /arch/sparc
parent0542eb7de7d5244d159f827a0c9bd8c01792bd13 (diff)
sparc64: check if a client is allowed to register for MDESC notifications
Check if a client is supported, by comparing against a whitelist, to register for notifications from Machine Description (MDESC) Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/mdesc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 04b76267ddfa..f795ee015738 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -284,9 +284,26 @@ static struct mdesc_notifier_client *client_list;
void mdesc_register_notifier(struct mdesc_notifier_client *client)
{
+ bool supported = false;
u64 node;
+ int i;
mutex_lock(&mdesc_mutex);
+
+ /* check to see if the node is supported for registration */
+ for (i = 0; md_node_ops_table[i].name != NULL; i++) {
+ if (strcmp(md_node_ops_table[i].name, client->node_name) == 0) {
+ supported = true;
+ break;
+ }
+ }
+
+ if (!supported) {
+ pr_err("MD: %s node not supported\n", client->node_name);
+ mutex_unlock(&mdesc_mutex);
+ return;
+ }
+
client->next = client_list;
client_list = client;