diff --git a/src/cryptsetup.c b/src/cryptsetup.c index edbb1881..de4439d8 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -2189,6 +2189,7 @@ static int action_luksResume(void) char *password = NULL; size_t passwordLen; int r, tries; + struct crypt_active_device cad; const char *req_type = luksType(device_type); if (req_type && !isLUKS(req_type)) @@ -2208,6 +2209,16 @@ static int action_luksResume(void) goto out; } + r = crypt_get_active_device(cd, action_argv[0], &cad); + if (r < 0) + goto out; + + if (!(cad.flags & CRYPT_ACTIVATE_SUSPENDED)) { + log_err(_("Volume %s is not suspended."), action_argv[0]); + r = -EINVAL; + goto out; + } + /* try to resume LUKS2 device by token first */ r = crypt_resume_by_token_pin(cd, action_argv[0], ARG_STR(OPT_TOKEN_TYPE_ID), ARG_INT32(OPT_TOKEN_ID_ID), NULL, 0, NULL);