[dm-devel] dm-crypt: support using encrypted keys

Mike Snitzer snitzer at redhat.com
Tue Apr 21 18:59:49 UTC 2020


On Tue, Apr 21 2020 at  2:32P -0400,
Dmitry Baryshkov <dbaryshkov at gmail.com> wrote:

> вт, 21 апр. 2020 г. в 21:27, Mike Snitzer <snitzer at redhat.com>:
> >
> > On Mon, Apr 20 2020 at  9:46P -0400,
> > Dmitry Baryshkov <dbaryshkov at gmail.com> wrote:
> >
> > > From: Dmitry Baryshkov <dmitry_baryshkov at mentor.com>
> > >
> > > Allow one to use encrypted in addition to user and login key types for
> > > device encryption.
> > >
> > > Signed-off-by: Dmitry Baryshkov <dmitry_baryshkov at mentor.com>
> >
> > I fixed up some issues, please see the following incremental patch,
> > I'll get this folded in and staged for 5.8.
> 
> Thank you!

Actually, I think this is needed too -- but please correct me if I'm wrong:

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index a4c4afc67a3d..ba4d15476862 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -2235,8 +2235,9 @@ static int set_key_user(struct crypt_config *cc, struct key *key)
 
 static int set_key_encrypted(struct crypt_config *cc, struct key *key)
 {
-	struct encrypted_key_payload *ekp = key->payload.data[0];
+	const struct encrypted_key_payload *ekp;
 
+	ekp = dereference_key_locked(key);
 	if (!ekp)
 		return -EKEYREVOKED;
 





More information about the dm-devel mailing list