KEYS: struct key_preparsed_payload should have two payload pointers
authorDavid Howells <dhowells@redhat.com>
Fri, 18 Jul 2014 17:56:34 +0000 (18:56 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 22 Jul 2014 20:46:02 +0000 (21:46 +0100)
struct key_preparsed_payload should have two payload pointers to correspond
with those in struct key.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Sage Weil <sage@redhat.com>
crypto/asymmetric_keys/asymmetric_type.c
crypto/asymmetric_keys/x509_public_key.c
include/linux/key-type.h
security/keys/encrypted-keys/encrypted.c
security/keys/key.c

index c1fe0fcee8e352bf9e94ad2f10808df07b1dc4c8..21960a4e74e8c193e8a69e07e0611c7139aaa82f 100644 (file)
@@ -156,7 +156,7 @@ static void asymmetric_key_free_preparse(struct key_preparsed_payload *prep)
        pr_devel("==>%s()\n", __func__);
 
        if (subtype) {
-               subtype->destroy(prep->payload);
+               subtype->destroy(prep->payload[0]);
                module_put(subtype->owner);
        }
        kfree(prep->type_data[1]);
index 382ef0d2ff2e5e030c0068d1076155364d48f43d..3fc8a0634ed7daa5eabd40a25f79e02374e67fbb 100644 (file)
@@ -177,7 +177,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
        __module_get(public_key_subtype.owner);
        prep->type_data[0] = &public_key_subtype;
        prep->type_data[1] = cert->fingerprint;
-       prep->payload = cert->pub;
+       prep->payload[0] = cert->pub;
        prep->description = desc;
        prep->quotalen = 100;
 
index 88503dca2a572d39591ffecb1fc9384bd14cf138..d2b4845d74bf1bccde14feb61f6c9e8980599e82 100644 (file)
@@ -41,7 +41,7 @@ struct key_construction {
 struct key_preparsed_payload {
        char            *description;   /* Proposed key description (or NULL) */
        void            *type_data[2];  /* Private key-type data */
-       void            *payload;       /* Proposed payload */
+       void            *payload[2];    /* Proposed payload */
        const void      *data;          /* Raw data */
        size_t          datalen;        /* Raw datalen */
        size_t          quotalen;       /* Quota length for proposed payload */
index 5fe443d120afe81826902cc70efecff24ccee1bb..d252c5704f8a087005f345cff961ee2c1d1ad6be 100644 (file)
@@ -811,7 +811,7 @@ static int encrypted_instantiate(struct key *key,
                goto out;
        }
 
-       rcu_assign_keypointer(key, epayload);
+       prep->payload[0] = epayload;
 out:
        kfree(datablob);
        return ret;
index 7c9acbf106b6fc3a8192def4e753e0bd1ce278ad..03620a35a4dcd29020a736eb925ab8ff99562a34 100644 (file)
@@ -1043,10 +1043,12 @@ int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep)
        if (ret == 0) {
                key->type_data.p[0] = prep->type_data[0];
                key->type_data.p[1] = prep->type_data[1];
-               rcu_assign_keypointer(key, prep->payload);
+               rcu_assign_keypointer(key, prep->payload[0]);
+               key->payload.data2[1] = prep->payload[1];
                prep->type_data[0] = NULL;
                prep->type_data[1] = NULL;
-               prep->payload = NULL;
+               prep->payload[0] = NULL;
+               prep->payload[1] = NULL;
        }
        pr_devel("<==%s() = %d\n", __func__, ret);
        return ret;