add remainders to fix some longstanding issues

This commit is contained in:
Ondrej Kozina
2017-09-19 14:53:22 +02:00
committed by Milan Broz
parent 19a1852e4b
commit 0f4d83960f

View File

@@ -1998,6 +1998,15 @@ int crypt_resize(struct crypt_device *cd, const char *name, uint64_t new_size)
struct crypt_dm_active_device dmd = {}; struct crypt_dm_active_device dmd = {};
int r; int r;
/*
* FIXME: check context uuid matches the dm-crypt device uuid.
* Currently it's possible to resize device (name)
* unrelated to device loaded in context.
*
* Also with LUKS2 we must not allow resize when there's
* explicit size stored in metadata (length != "dynamic")
*/
/* Device context type must be initialised */ /* Device context type must be initialised */
if (!cd || !cd->type || !name) if (!cd || !cd->type || !name)
return -EINVAL; return -EINVAL;
@@ -2268,6 +2277,8 @@ int crypt_suspend(struct crypt_device *cd,
crypt_status_info ci; crypt_status_info ci;
int r; int r;
/* FIXME: check context uuid matches the dm-crypt device uuid (onlyLUKS branching) */
if (!cd || !name) if (!cd || !name)
return -EINVAL; return -EINVAL;
@@ -2329,6 +2340,8 @@ int crypt_resume_by_passphrase(struct crypt_device *cd,
struct volume_key *vk = NULL; struct volume_key *vk = NULL;
int r; int r;
/* FIXME: check context uuid matches the dm-crypt device uuid */
if (!passphrase || !name) if (!passphrase || !name)
return -EINVAL; return -EINVAL;
@@ -2389,6 +2402,8 @@ int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
size_t passphrase_size_read; size_t passphrase_size_read;
int r; int r;
/* FIXME: check context uuid matches the dm-crypt device uuid */
if (!name || !keyfile) if (!name || !keyfile)
return -EINVAL; return -EINVAL;