From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Doug Maxey <dwm@maxeymade.com>,
Linux IDE <linux-ide@vger.kernel.org>
Subject: [PATCH libata-2.6 2/5] Fix sg increase problem in __atapi_pio_bytes()
Date: Fri, 18 Mar 2005 15:39:12 +0800 [thread overview]
Message-ID: <423A85A0.4040206@tw.ibm.com> (raw)
[-- 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;
}
}
reply other threads:[~2005-03-18 7:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=423A85A0.4040206@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=bzolnier@gmail.com \
--cc=dwm@maxeymade.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).