Patch "scsi: target: pscsi: Clean up after failure in pscsi_map_sg()" has been added to the 4.9-stable tree

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

 



This is a note to let you know that I've just added the patch titled

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

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-target-pscsi-clean-up-after-failure-in-pscsi_ma.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0b8b4caf8e8a0bc38683baea45e6c073ae2dce7f
Author: Martin Wilck <mwilck@xxxxxxxx>
Date:   Tue Mar 23 22:24:31 2021 +0100

    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@xxxxxxxx
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: Lee Duncan <lduncan@xxxxxxxx>
    Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index ef1c8c158f66..079db0bd3917 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -951,6 +951,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	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;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux