diff options
author | Ming Lei <[email protected]> | 2018-04-16 17:48:41 +0800 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2018-04-19 00:41:03 -0400 |
commit | 8e1ceafe50ec4d1bcfae154dd70e7cb6946a6177 (patch) | |
tree | 2fe1f5db06d2b1ab9358cf12187844968d96e174 | |
parent | ccce20fc7968d546fb1e8e147bf5cdc8afc4278a (diff) |
scsi: target: fix crash with iscsi target and dvd
When the current page can't be added to bio, one new bio should be
created for adding this page again, instead of ignoring this page.
This patch fixes kernel crash with iscsi target and dvd, as reported by
Wakko.
Cc: Wakko Warner <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: "Nicholas A. Bellinger" <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Fixes: 84c8590646d5b35804 ("target: avoid accessing .bi_vcnt directly")
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/target/target_core_pscsi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 0d99b242e82e..6cb933ecc084 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -890,6 +890,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, bytes = min(bytes, data_len); if (!bio) { +new_bio: nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); nr_pages -= nr_vecs; /* @@ -931,6 +932,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, * be allocated with pscsi_get_bio() above. */ bio = NULL; + goto new_bio; } data_len -= bytes; |