Skip to content

Commit 47f0461

Browse files
Matthias Kaehlckekees
authored andcommitted
dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter
Add a NULL check for the 'bdev' parameter of dm_verity_loadpin_is_bdev_trusted(). The function is called by loadpin_check(), which passes the block device that corresponds to the super block of the file system from which a file is being loaded. Generally a super_block structure has an associated block device, however that is not always the case (e.g. tmpfs). Cc: [email protected] # v6.0+ Fixes: b6c1c57 ("dm: Add verity helpers for LoadPin") Signed-off-by: Matthias Kaehlcke <[email protected]> Link: https://lore.kernel.org/r/20230627202800.1.Id63f7f59536d20f1ab83e1abdc1fda1471c7d031@changeid Signed-off-by: Kees Cook <[email protected]>
1 parent acf15e0 commit 47f0461

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/md/dm-verity-loadpin.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ bool dm_verity_loadpin_is_bdev_trusted(struct block_device *bdev)
5858
int srcu_idx;
5959
bool trusted = false;
6060

61+
if (bdev == NULL)
62+
return false;
63+
6164
if (list_empty(&dm_verity_loadpin_trusted_root_digests))
6265
return false;
6366

0 commit comments

Comments
 (0)