Skip to content
Snippets Groups Projects
Commit 36fa766f authored by Martin Wilck's avatar Martin Wilck Committed by Martin K. Petersen
Browse files

scsi: target: pscsi: Clean up after failure in pscsi_map_sg()

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 077ce028
No related merge requests found
...@@ -938,6 +938,14 @@ new_bio: ...@@ -938,6 +938,14 @@ new_bio:
return 0; return 0;
fail: 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; return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment