diff options
author | Martin Wilck <mwilck@suse.com> | 2021-03-23 22:24:31 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-03-25 04:19:23 +0100 |
commit | 36fa766faa0c822c860e636fe82b1affcd022974 (patch) | |
tree | 1b190a28f629a66e60958b510c1c48f3deb68389 /drivers/target | |
parent | scsi: target: pscsi: Avoid OOM in pscsi_map_sg() (diff) | |
download | linux-36fa766faa0c822c860e636fe82b1affcd022974.tar.xz linux-36fa766faa0c822c860e636fe82b1affcd022974.zip |
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: 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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_pscsi.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 6fa9fddc2e1e..9ee797b8cb7e 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -938,6 +938,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; } |