summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2024-07-04 16:09:57 +0200
committerMikulas Patocka <mpatocka@redhat.com>2024-07-10 13:10:06 +0200
commit3708c7269593b836b1d684214cd9f5d83e4ed3fd (patch)
tree5c2012976ffb474d9d778b4033586c529fdaf776 /drivers/md
parent9d45db03acf9cee4f83148c403d105b1a38a0f23 (diff)
downloadlwn-3708c7269593b836b1d684214cd9f5d83e4ed3fd.tar.gz
lwn-3708c7269593b836b1d684214cd9f5d83e4ed3fd.zip
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: b6c1c5745ccc ("dm: Add verity helpers for LoadPin") Cc: stable@vger.kernel.org Cc: Matthias Kaehlcke <mka@chromium.org> Cc: Kees Cook <keescook@chromium.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-verity-target.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 0a2399d958b7..cf659c8feb29 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -1522,14 +1522,6 @@ bad:
}
/*
- * Check whether a DM target is a verity target.
- */
-bool dm_is_verity_target(struct dm_target *ti)
-{
- return ti->type->module == THIS_MODULE;
-}
-
-/*
* Get the verity mode (error behavior) of a verity target.
*
* Returns the verity mode of the target, or -EINVAL if 'ti' is not a verity
@@ -1582,6 +1574,14 @@ static struct target_type verity_target = {
};
module_dm(verity);
+/*
+ * Check whether a DM target is a verity target.
+ */
+bool dm_is_verity_target(struct dm_target *ti)
+{
+ return ti->type == &verity_target;
+}
+
MODULE_AUTHOR("Mikulas Patocka <mpatocka@redhat.com>");
MODULE_AUTHOR("Mandeep Baines <msb@chromium.org>");
MODULE_AUTHOR("Will Drewry <wad@chromium.org>");