All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: fix crash with iscsi target and dvd
@ 2018-04-16  9:48 ` Ming Lei
  0 siblings, 0 replies; 10+ messages in thread
From: Ming Lei @ 2018-04-16  9:48 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Ming Lei, Wakko Warner, Bart Van Assche,
	target-devel, linux-scsi, Nicholas A. Bellinger,
	Christoph Hellwig

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 <wakko@animx.eu.org>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: target-devel@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: Christoph Hellwig <hch@lst.de>
Fixes: 84c8590646d5b35804 ("target: avoid accessing .bi_vcnt directly")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/target/target_core_pscsi.c | 2 ++
 1 file changed, 2 insertions(+)

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;
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-04-19  4:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-16  9:48 [PATCH] target: fix crash with iscsi target and dvd Ming Lei
2018-04-16  9:48 ` Ming Lei
2018-04-17 15:15 ` Christoph Hellwig
2018-04-17 15:15   ` Christoph Hellwig
2018-04-19  3:27   ` Martin K. Petersen
2018-04-19  3:27     ` Martin K. Petersen
2018-04-19  3:40     ` Bart Van Assche
2018-04-19  3:40       ` Bart Van Assche
2018-04-19  4:41 ` Martin K. Petersen
2018-04-19  4:41   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.