Skip to content

Commit 451cc65

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 2e170d8 commit 451cc65

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/md/dm-verity-fec.c

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

536-
if (f->data_bufio)
536+
if (!IS_ERR_OR_NULL(f->data_bufio))
537537
dm_bufio_client_destroy(f->data_bufio);
538-
if (f->bufio)
538+
if (!IS_ERR_OR_NULL(f->bufio))
539539
dm_bufio_client_destroy(f->bufio);
540540

541541
if (f->dev)

0 commit comments

Comments
 (0)