summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorMartin Wilck <mwilck@suse.com>2021-03-23 22:24:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-10 13:20:11 +0200
commita92224638efc45b646e171857f1ee08b92a3ee3b (patch)
tree1da7de9a5c2a81a2f4093c31047e3dbb2b9efceb /drivers/target
parent533dbcdc30fa4d1f78dca3fce9a894d72c7f085b (diff)
downloadlinux-stable-a92224638efc45b646e171857f1ee08b92a3ee3b.tar.gz
linux-stable-a92224638efc45b646e171857f1ee08b92a3ee3b.tar.bz2
linux-stable-a92224638efc45b646e171857f1ee08b92a3ee3b.zip
scsi: target: pscsi: Clean up after failure in pscsi_map_sg()
[ Upstream commit 36fa766faa0c822c860e636fe82b1affcd022974 ] If pscsi_map_sg() fails, make sure to drop references to already allocated bios. Link: https://lore.kernel.org/r/20210323212431.15306-2-mwilck@suse.com Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Martin Wilck <mwilck@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_pscsi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 6cb933ecc084..f80b31b35a0d 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -949,6 +949,14 @@ new_bio:
return 0;
fail:
+ if (bio)
+ bio_put(bio);
+ while (req->bio) {
+ bio = req->bio;
+ req->bio = bio->bi_next;
+ bio_put(bio);
+ }
+ req->biotail = NULL;
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
}