aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2021-04-05 22:57:29 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2021-04-05 22:57:29 -0400
commit556666bce111b2a758010c2a2a6bab7f3770f4de (patch)
tree3a35ea6f9a9aa43b82166afc1f329084dd55c729 /drivers/target
parentscsi: message: mptlan: Replace one-element array with flexible-array member (diff)
parentscsi: iscsi: Fix race condition between login and sync thread (diff)
downloadlinux-dev-556666bce111b2a758010c2a2a6bab7f3770f4de.tar.xz
linux-dev-556666bce111b2a758010c2a2a6bab7f3770f4de.zip
Merge branch '5.12/scsi-fixes' into 5.13/scsi-staging
Pull 5.12/scsi-fixes into the 5.13 SCSI tree to provide a baseline for some UFS changes that would otherwise cause conflicts during the merge. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_pscsi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 7b1035e08419..1c9aeab93477 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -881,7 +881,6 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
if (!bio) {
new_bio:
nr_vecs = bio_max_segs(nr_pages);
- nr_pages -= nr_vecs;
/*
* Calls bio_kmalloc() and sets bio->bi_end_io()
*/
@@ -938,6 +937,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;
}