Skip to content
/ linux Public

Commit 031f2ad

Browse files
Eric BiggersSasha Levin
authored andcommitted
dm-verity: correctly handle dm_bufio_client_create() failure
[ Upstream commit 119f4f0 ] If either of the calls to dm_bufio_client_create() in verity_fec_ctr() fails, then dm_bufio_client_destroy() is later called with an ERR_PTR() argument. That causes a crash. Fix this. Fixes: a739ff3 ("dm verity: add support for forward error correction") Cc: stable@vger.kernel.org Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a9ddc03 commit 031f2ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/dm-verity-fec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ void verity_fec_dtr(struct dm_verity *v)
566566
mempool_exit(&f->output_pool);
567567
kmem_cache_destroy(f->cache);
568568

569-
if (f->data_bufio)
569+
if (!IS_ERR_OR_NULL(f->data_bufio))
570570
dm_bufio_client_destroy(f->data_bufio);
571-
if (f->bufio)
571+
if (!IS_ERR_OR_NULL(f->bufio))
572572
dm_bufio_client_destroy(f->bufio);
573573

574574
if (f->dev)

0 commit comments

Comments
 (0)