Skip to contentSkip to conversation

target: fix crash with iscsi target and dvd

PATCH In review Ming Lei 4 participants 5 messages Apr 16, 2018 – Apr 19, 2018

Subsystems (2)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 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 "Nicholas A. Bellinger" <[email protected]>
Cc Christoph Hellwig <[email protected]>
Fixes 84c8590646d5b35804 ("target: avoid accessing .bi_vcnt directly")
---
 drivers/target/target_core_pscsi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/target/target_core_pscsi.c +2 -0
index 0d99b242e82e..6cb933ecc084 100644
@@ -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;
Signature · 1 line
2.9.5
Reviewed-by on v1 1/1
#1 lore raw

Looks good,

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.

#2 lore raw

Christoph,

Quoted 3 lines

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.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw

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

#4 lore raw
In reply to Ming Lei

Ming,

Quoted 5 lines

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.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering