linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target: fix crash with iscsi target and dvd
@ 2018-04-16  9:48 Ming Lei
  2018-04-17 15:15 ` Christoph Hellwig
  2018-04-19  4:41 ` Martin K. Petersen
  0 siblings, 2 replies; 5+ 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] 5+ messages in thread

* Re: [PATCH] target: fix crash with iscsi target and dvd
  2018-04-16  9:48 [PATCH] target: fix crash with iscsi target and dvd Ming Lei
@ 2018-04-17 15:15 ` Christoph Hellwig
  2018-04-19  3:27   ` Martin K. Petersen
  2018-04-19  4:41 ` Martin K. Petersen
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2018-04-17 15:15 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Wakko Warner, Bart Van Assche,
	target-devel, linux-scsi, Nicholas A. Bellinger,
	Christoph Hellwig

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Btw, seems like someone needs to volunteer for putting together a pull
request with target fixes for Linus - I haven't heard from Nic for
a while, and we've got quite a few fixes out on the list.

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

* Re: [PATCH] target: fix crash with iscsi target and dvd
  2018-04-17 15:15 ` Christoph Hellwig
@ 2018-04-19  3:27   ` Martin K. Petersen
  2018-04-19  3:40     ` Bart Van Assche
  0 siblings, 1 reply; 5+ messages in thread
From: Martin K. Petersen @ 2018-04-19  3:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Ming Lei, Jens Axboe, linux-block, Wakko Warner, Bart Van Assche,
	target-devel, linux-scsi, Nicholas A. Bellinger


Christoph,

> Btw, seems like someone needs to volunteer for putting together a pull
> request with target fixes for Linus - I haven't heard from Nic for a
> while, and we've got quite a few fixes out on the list.

Still happy to take things through SCSI if Nic doesn't materialize.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] target: fix crash with iscsi target and dvd
  2018-04-19  3:27   ` Martin K. Petersen
@ 2018-04-19  3:40     ` Bart Van Assche
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2018-04-19  3:40 UTC (permalink / raw)
  To: hch, martin.petersen
  Cc: linux-scsi, wakko, linux-block, target-devel, nab, ming.lei, axboe

T24gV2VkLCAyMDE4LTA0LTE4IGF0IDIzOjI3IC0wNDAwLCBNYXJ0aW4gSy4gUGV0ZXJzZW4gd3Jv
dGU6DQo+IENocmlzdG9waCwNCj4gDQo+ID4gQnR3LCBzZWVtcyBsaWtlIHNvbWVvbmUgbmVlZHMg
dG8gdm9sdW50ZWVyIGZvciBwdXR0aW5nIHRvZ2V0aGVyIGEgcHVsbA0KPiA+IHJlcXVlc3Qgd2l0
aCB0YXJnZXQgZml4ZXMgZm9yIExpbnVzIC0gSSBoYXZlbid0IGhlYXJkIGZyb20gTmljIGZvciBh
DQo+ID4gd2hpbGUsIGFuZCB3ZSd2ZSBnb3QgcXVpdGUgYSBmZXcgZml4ZXMgb3V0IG9uIHRoZSBs
aXN0Lg0KPiANCj4gU3RpbGwgaGFwcHkgdG8gdGFrZSB0aGluZ3MgdGhyb3VnaCBTQ1NJIGlmIE5p
YyBkb2Vzbid0IG1hdGVyaWFsaXplLg0KDQpIZWxsbyBNYXJ0aW4sDQoNCkNhbiB5b3UgaGF2ZSBh
IGxvb2sgYXQgdGhlIGZvbGxvd2luZyBwYXRjaCBzZXJpZXM6ICJbUEFUQ0ggMDAvMTRdIFNDU0kg
dGFyZ2V0DQpwYXRjaGVzIGZvciBrZXJuZWwgdjQuMTciIChodHRwczovL3d3dy5zcGluaWNzLm5l
dC9saXN0cy90YXJnZXQtZGV2ZWwvbXNnMTY1MjMuaHRtbCAvDQpodHRwczovL3BhdGNod29yay5r
ZXJuZWwub3JnL3Byb2plY3QvdGFyZ2V0LWRldmVsL2xpc3QvKS4gUGxlYXNlIGxldCBtZSBrbm93
IGlmIHlvdQ0Kd2FudCBtZSB0byByZXBvc3QgdGhhdCBwYXRjaCBzZXJpZXMuDQoNClRoYW5rcywN
Cg0KQmFydC4NCg0KDQoNCg==

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

* Re: [PATCH] target: fix crash with iscsi target and dvd
  2018-04-16  9:48 [PATCH] target: fix crash with iscsi target and dvd Ming Lei
  2018-04-17 15:15 ` Christoph Hellwig
@ 2018-04-19  4:41 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2018-04-19  4:41 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Wakko Warner, Bart Van Assche,
	target-devel, linux-scsi, Nicholas A. Bellinger,
	Christoph Hellwig


Ming,

> 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.

I queued this up in 4.17/scsi-fixes.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

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

Thread overview: 5+ 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-17 15:15 ` Christoph Hellwig
2018-04-19  3:27   ` Martin K. Petersen
2018-04-19  3:40     ` Bart Van Assche
2018-04-19  4:41 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).