Skip to content

Commit 3708c72

Browse files
Eric BiggersMikulas Patocka
authored andcommitted
dm-verity: fix dm_is_verity_target() when dm-verity is builtin
When CONFIG_DM_VERITY=y, dm_is_verity_target() returned true for any builtin dm target, not just dm-verity. Fix this by checking for verity_target instead of THIS_MODULE (which is NULL for builtin code). Fixes: b6c1c57 ("dm: Add verity helpers for LoadPin") Cc: [email protected] Cc: Matthias Kaehlcke <[email protected]> Cc: Kees Cook <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 9d45db0 commit 3708c72

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/md/dm-verity-target.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,14 +1521,6 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
15211521
return r;
15221522
}
15231523

1524-
/*
1525-
* Check whether a DM target is a verity target.
1526-
*/
1527-
bool dm_is_verity_target(struct dm_target *ti)
1528-
{
1529-
return ti->type->module == THIS_MODULE;
1530-
}
1531-
15321524
/*
15331525
* Get the verity mode (error behavior) of a verity target.
15341526
*
@@ -1582,6 +1574,14 @@ static struct target_type verity_target = {
15821574
};
15831575
module_dm(verity);
15841576

1577+
/*
1578+
* Check whether a DM target is a verity target.
1579+
*/
1580+
bool dm_is_verity_target(struct dm_target *ti)
1581+
{
1582+
return ti->type == &verity_target;
1583+
}
1584+
15851585
MODULE_AUTHOR("Mikulas Patocka <[email protected]>");
15861586
MODULE_AUTHOR("Mandeep Baines <[email protected]>");
15871587
MODULE_AUTHOR("Will Drewry <[email protected]>");

0 commit comments

Comments
 (0)