From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Albert Lee <albertcc@tw.ibm.com>
Cc: Jeff Garzik <jgarzik@pobox.com>, Doug Maxey <dwm@maxeymade.com>,
Linux IDE <linux-ide@vger.kernel.org>
Subject: Re: PATCH libata-2.6 4/5] Prevent the device from overrunning the buffer in __atapi_pio_bytes()
Date: Fri, 18 Mar 2005 09:31:16 +0100 [thread overview]
Message-ID: <58cb370e0503180031d40b0a3@mail.gmail.com> (raw)
In-Reply-To: <423A8AA4.5040601@tw.ibm.com>
On Fri, 18 Mar 2005 16:00:36 +0800, Albert Lee <albertcc@tw.ibm.com> wrote:
> Hi Jeff,
>
> Problem:
> Some bad behaved CD-ROM drives will return more data than ask to.
> (I have such CD-RW drive and it crashed the kernel.)
These devices are compliant with original ATAPI spec.
Such condition shouldn't be treated as an error
- extra data should be read and dumped.
> Changes:
> - Add additional check in __atapi_pio_bytes() to prevent the device from overrunning the buffer.
>
> 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-reorder/drivers/scsi/libata-core.c 2005-03-18 12:56:44.000000000 +0800
> +++ libata-2.6-extrabytes/drivers/scsi/libata-core.c 2005-03-18 14:00:34.000000000 +0800
> @@ -2338,6 +2338,14 @@
> ap->pio_task_state = PIO_ST_LAST;
>
> next_sg:
> + /* check whether qc->sg is full */
> + if (unlikely(qc->cursg >= qc->n_elem)) {
> + printk(KERN_WARNING "ata%u: qc->sg full, %u bytes trailing\n", ap->id, bytes);
> +
> + ap->pio_task_state = PIO_ST_ERR;
> + return;
> + }
> +
> sg = &qc->sg[qc->cursg];
>
> page = sg->page;
>
>
> --- libata-2.6-reorder/drivers/scsi/libata-core.c 2005-03-18 12:56:44.000000000 +0800
> +++ libata-2.6-extrabytes/drivers/scsi/libata-core.c 2005-03-18 14:00:34.000000000 +0800
> @@ -2338,6 +2338,14 @@
> ap->pio_task_state = PIO_ST_LAST;
>
> next_sg:
> + /* check whether qc->sg is full */
> + if (unlikely(qc->cursg >= qc->n_elem)) {
> + printk(KERN_WARNING "ata%u: qc->sg full, %u bytes trailing\n", ap->id, bytes);
> +
> + ap->pio_task_state = PIO_ST_ERR;
> + return;
> + }
> +
> sg = &qc->sg[qc->cursg];
>
> page = sg->page;
>
>
>
next prev parent reply other threads:[~2005-03-18 8:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-18 8:00 PATCH libata-2.6 4/5] Prevent the device from overrunning the buffer in __atapi_pio_bytes() Albert Lee
2005-03-18 8:31 ` Bartlomiej Zolnierkiewicz [this message]
2005-03-18 9:04 ` Albert Lee
2005-03-22 19:11 ` Jeff Garzik
2005-03-29 12:41 ` Albert Lee
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=58cb370e0503180031d40b0a3@mail.gmail.com \
--to=bzolnier@gmail.com \
--cc=albertcc@tw.ibm.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).