Fix sg increase problem in __atapi_pio_bytes()
PATCH 2/5 Fix sg increase problem in __atapi_pio_bytes()
Hi Jeff,
Problem:
In __atapi_pio_bytes(), after qc->cursg++ increased, if "goto next_page" is executed,
then sg is not updated and the old sg is overwritten with the new data.
Changes:
- Replace goto next_page by goto next_sg.
Attached please find the patch against the libata-2.6 tree for your review. Thanks.
Albert
Signed-off-by Albert Lee <[email protected]>
---------------------------------------
drivers/scsi/libata-core.c +1 -3
@@ -2340,7 +2340,6 @@ next_sg: sg = &qc->sg[qc->cursg]; -next_page: page = sg->page; offset = sg->offset + qc->cursg_ofs;
@@ -2348,6 +2347,7 @@ page =nth_page (page, (offset >>PAGE_SHIFT )); offset %=PAGE_SIZE ; +/* don't overrun current sg */ count =min (sg->length - qc->cursg_ofs, bytes);/* don't cross page boundaries */
@@ -2372,8 +2372,6 @@kunmap (page);if (bytes) { -if (qc->cursg_ofs < sg->length) - goto next_page; goto next_sg; } }
drivers/scsi/libata-core.c +1 -3
@@ -2340,7 +2340,6 @@ next_sg: sg = &qc->sg[qc->cursg]; -next_page: page = sg->page; offset = sg->offset + qc->cursg_ofs;
@@ -2348,6 +2347,7 @@ page =nth_page (page, (offset >>PAGE_SHIFT )); offset %=PAGE_SIZE ; +/* don't overrun current sg */ count =min (sg->length - qc->cursg_ofs, bytes);/* don't cross page boundaries */
@@ -2372,8 +2372,6 @@kunmap (page);if (bytes) { -if (qc->cursg_ofs < sg->length) - goto next_page; goto next_sg; } }