]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sparc64: check if a client is allowed to register for MDESC notifications
authorJag Raman <jag.raman@oracle.com>
Fri, 23 Jun 2017 18:58:37 +0000 (14:58 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 25 Jun 2017 20:43:14 +0000 (13:43 -0700)
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>
arch/sparc/kernel/mdesc.c

index 04b76267ddfaa03548e894ec96de6faf6d30a654..f795ee015738f466177d2f208a213d528c814588 100644 (file)
@@ -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;