summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_pscsi.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-05 08:59:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-05 08:59:21 +0200
commit9594408763d439287742d5582842db6a476bbd71 (patch)
tree2a0787dae55a3372108837cc8ce3261beac6ff46 /drivers/target/target_core_pscsi.c
parent202680c7a93713283207dedfbc4b550ad6836a43 (diff)
parente49d033bddf5b565044e2abe4241353959bc9120 (diff)
downloadlinux-9594408763d439287742d5582842db6a476bbd71.tar.gz
linux-9594408763d439287742d5582842db6a476bbd71.tar.bz2
linux-9594408763d439287742d5582842db6a476bbd71.zip
Merge 5.12-rc6 into tty-next
We need the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/target/target_core_pscsi.c')
-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 3cbc074992bc..9ee797b8cb7e 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -882,7 +882,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()
*/
@@ -939,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;
}