KEYS: trusted: correctly initialize digests and fix locking issue
[sfrench/cifs-2.6.git] / security / keys / trusted.c
index ade69913106540e4e1918b88654a8914f3bbe29d..1fbd778166105af254c345f34c3093edc56ef296 100644 (file)
@@ -1228,11 +1228,16 @@ hashalg_fail:
 
 static int __init init_digests(void)
 {
+       int i;
+
        digests = kcalloc(chip->nr_allocated_banks, sizeof(*digests),
                          GFP_KERNEL);
        if (!digests)
                return -ENOMEM;
 
+       for (i = 0; i < chip->nr_allocated_banks; i++)
+               digests[i].alg_id = chip->allocated_banks[i].alg_id;
+
        return 0;
 }