提交 6952df03 编写于 作者: A Albert Lee 提交者: Jeff Garzik

[PATCH] sg traverse fix for __atapi_pio_bytes()

Problem:
Incorrect md5sum when using ATAPI PIO mode to verify a distro CD.

Root cause:  sg traverse problem.
In __atapi_pio_bytes(), if qc->cursg++ is increased and "goto
next_page" is executed, then sg is not updated to the new qc->cursg
and the old sg is overwritten with the new data.

Changes:
- Replace "goto next_page" with "goto next_sg" to make sg updated.
Signed-off-by: NAlbert Lee <albertcc@tw.ibm.com>
上级 e1dd23a0
......@@ -2577,7 +2577,6 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
next_sg:
sg = &qc->sg[qc->cursg];
next_page:
page = sg->page;
offset = sg->offset + qc->cursg_ofs;
......@@ -2585,6 +2584,7 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
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 */
......@@ -2609,8 +2609,6 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
kunmap(page);
if (bytes) {
if (qc->cursg_ofs < sg->length)
goto next_page;
goto next_sg;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册