Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bd87b6e authored by Neeraj Soni's avatar Neeraj Soni Committed by Pruthvi Kurada
Browse files

md: dm-default-key: Override dun value for selected bios



Over ride dun values for file encrypted bios only when 'set_dun' flag
is set, file system is ext4 and content-encryption mode is
FS_CRYPT_PRIVATE.

Change-Id: I3340f29c71dbfb6006450415a718b661e49a6ed0
Signed-off-by: default avatarNeeraj Soni <neersoni@codeaurora.org>
parent 43ae4899
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -391,11 +391,14 @@ static int default_key_map(struct dm_target *ti, struct bio *bio)
	if (WARN_ON_ONCE(dun[0] > dkc->max_dun))
		return DM_MAPIO_KILL;

	if (!bio_has_crypt_ctx(bio))
	if (!bio_has_crypt_ctx(bio)) {
		bio_crypt_set_ctx(bio, &dkc->key, dun, GFP_NOIO);

		if (dkc->set_dun)
			default_key_map_dun(bio, dun);
	} else {
		if (dkc->set_dun && bio->bi_crypt_context->is_ext4)
			default_key_map_dun(bio, dun);
	}

	return DM_MAPIO_REMAPPED;
}