Disallow header restore if context is nonLUKS device.
authorMilan Broz <gmazyland@gmail.com>
Fri, 7 Dec 2012 14:55:56 +0000 (15:55 +0100)
committerMilan Broz <gmazyland@gmail.com>
Fri, 7 Dec 2012 14:55:56 +0000 (15:55 +0100)
lib/setup.c

index 992f3c4..cf4d260 100644 (file)
@@ -1380,6 +1380,9 @@ int crypt_header_restore(struct crypt_device *cd,
        if (requested_type && !isLUKS(requested_type))
                return -EINVAL;
 
+       if (cd->type && !isLUKS(cd->type))
+               return -EINVAL;
+
        r = init_crypto(cd);
        if (r < 0)
                return r;