* [PATCH libata-2.6 2/5] Fix sg increase problem in __atapi_pio_bytes()
@ 2005-03-18 7:39 Albert Lee
0 siblings, 0 replies; only message in thread
From: Albert Lee @ 2005-03-18 7:39 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Bartlomiej Zolnierkiewicz, Doug Maxey, Linux IDE
[-- Attachment #1: Type: text/plain, Size: 1088 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 <albertcc@tw.ibm.com>
---------------------------------------
--- libata-2.6-sgdma/drivers/scsi/libata-core.c 2005-03-17 17:23:42.000000000 +0800
+++ libata-2.6-atapi_pio_bytes/drivers/scsi/libata-core.c 2005-03-18 13:20:01.000000000 +0800
@@ -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;
}
}
[-- Attachment #2: cursg_fix.diff --]
[-- Type: text/plain, Size: 662 bytes --]
--- libata-2.6-sgdma/drivers/scsi/libata-core.c 2005-03-17 17:23:42.000000000 +0800
+++ libata-2.6-atapi_pio_bytes/drivers/scsi/libata-core.c 2005-03-18 13:20:01.000000000 +0800
@@ -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;
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-18 7:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-18 7:39 [PATCH libata-2.6 2/5] Fix sg increase problem in __atapi_pio_bytes() Albert Lee
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).