[PATCH] dm: fix uninitialized variable use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Damien Le Moal <damien.lemoal@xxxxxxx>

In dm_io_dec_pending(), make sure that the bio variable is initialized
to io->orig_bio before using it.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Fixes: 3a1e343c53ae ("dm: Forbid requeue of writes to zones")
Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx>
---
 drivers/md/dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index a89bb9bbe82d..e687d60212b6 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -796,6 +796,7 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
 	}
 
 	if (atomic_dec_and_test(&io->io_count)) {
+		bio = io->orig_bio;
 		if (io->status == BLK_STS_DM_REQUEUE) {
 			/*
 			 * Target requested pushing back the I/O.
@@ -804,7 +805,7 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
 			if (__noflush_suspending(md) &&
 			    !WARN_ON_ONCE(dm_is_zone_write(md, bio)))
 				/* NOTE early return due to BLK_STS_DM_REQUEUE below */
-				bio_list_add_head(&md->deferred, io->orig_bio);
+				bio_list_add_head(&md->deferred, bio);
 			else
 				/*
 				 * noflush suspend was interrupted or this is
@@ -815,7 +816,6 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
 		}
 
 		io_error = io->status;
-		bio = io->orig_bio;
 		end_io_acct(io);
 		free_io(md, io);
 
-- 
2.31.1


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux