* [PATCH] ide-cd: handle fragmented packet commands gracefully
@ 2009-06-21 8:55 Borislav Petkov
2009-06-22 9:50 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2009-06-21 8:55 UTC (permalink / raw)
To: bzolnier; +Cc: linux-ide, linux-kernel
There are some devices in the wild that clear the DRQ bit during the
last word of a packet command and therefore could use a "second chance"
for that last word of data to be xferred instead of simply failing the
request. Do that by attempting to suck in those last bytes in PIO mode.
In addition, the ATA_ERR bit has to be cleared for we cannot be sure the
data is valid otherwise.
See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-cd.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 4a19686..8d3f7d0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
}
} else if (!blk_pc_request(rq)) {
ide_cd_request_sense_fixup(drive, cmd);
- /* complain if we still have data left to transfer */
+
uptodate = cmd->nleft ? 0 : 1;
- if (uptodate == 0)
+
+ /*
+ * suck out the remaining bytes from the drive in an
+ * attempt to complete the data xfer. (see BZ#13399)
+ */
+ if (!(stat & ATA_ERR) && !uptodate && thislen) {
+ ide_pio_bytes(drive, cmd, write, thislen);
+ uptodate = cmd->nleft ? 0 : 1;
+ }
+
+ if (!uptodate)
rq->cmd_flags |= REQ_FAILED;
}
goto out_end;
--
1.6.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ide-cd: handle fragmented packet commands gracefully
2009-06-21 8:55 [PATCH] ide-cd: handle fragmented packet commands gracefully Borislav Petkov
@ 2009-06-22 9:50 ` Bartlomiej Zolnierkiewicz
2009-06-26 8:19 ` Borislav Petkov
0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-22 9:50 UTC (permalink / raw)
To: Borislav Petkov, David Miller; +Cc: linux-ide, linux-kernel
On Sunday 21 June 2009 10:55:27 Borislav Petkov wrote:
> There are some devices in the wild that clear the DRQ bit during the
> last word of a packet command and therefore could use a "second chance"
> for that last word of data to be xferred instead of simply failing the
> request. Do that by attempting to suck in those last bytes in PIO mode.
>
> In addition, the ATA_ERR bit has to be cleared for we cannot be sure the
> data is valid otherwise.
>
> See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
>
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/ide/ide-cd.c | 14 ++++++++++++--
> 1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> index 4a19686..8d3f7d0 100644
> --- a/drivers/ide/ide-cd.c
> +++ b/drivers/ide/ide-cd.c
> @@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
> }
> } else if (!blk_pc_request(rq)) {
> ide_cd_request_sense_fixup(drive, cmd);
> - /* complain if we still have data left to transfer */
> +
> uptodate = cmd->nleft ? 0 : 1;
> - if (uptodate == 0)
> +
> + /*
> + * suck out the remaining bytes from the drive in an
> + * attempt to complete the data xfer. (see BZ#13399)
> + */
> + if (!(stat & ATA_ERR) && !uptodate && thislen) {
> + ide_pio_bytes(drive, cmd, write, thislen);
> + uptodate = cmd->nleft ? 0 : 1;
> + }
> +
> + if (!uptodate)
> rq->cmd_flags |= REQ_FAILED;
> }
> goto out_end;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ide-cd: handle fragmented packet commands gracefully
2009-06-22 9:50 ` Bartlomiej Zolnierkiewicz
@ 2009-06-26 8:19 ` Borislav Petkov
2009-06-26 16:23 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2009-06-26 8:19 UTC (permalink / raw)
To: David Miller; +Cc: bzolnier, linux-ide, linux-kernel
Hi David,
On Mon, Jun 22, 2009 at 11:50:22AM +0200, Bartlomiej Zolnierkiewicz wrote:
> On Sunday 21 June 2009 10:55:27 Borislav Petkov wrote:
> > There are some devices in the wild that clear the DRQ bit during the
> > last word of a packet command and therefore could use a "second chance"
> > for that last word of data to be xferred instead of simply failing the
> > request. Do that by attempting to suck in those last bytes in PIO mode.
> >
> > In addition, the ATA_ERR bit has to be cleared for we cannot be sure the
> > data is valid otherwise.
> >
> > See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
> >
> > Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
>
> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
can you pick that one too, please. I can't seem to find it on patchwork.
Thanks.
>
> > ---
> > drivers/ide/ide-cd.c | 14 ++++++++++++--
> > 1 files changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> > index 4a19686..8d3f7d0 100644
> > --- a/drivers/ide/ide-cd.c
> > +++ b/drivers/ide/ide-cd.c
> > @@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
> > }
> > } else if (!blk_pc_request(rq)) {
> > ide_cd_request_sense_fixup(drive, cmd);
> > - /* complain if we still have data left to transfer */
> > +
> > uptodate = cmd->nleft ? 0 : 1;
> > - if (uptodate == 0)
> > +
> > + /*
> > + * suck out the remaining bytes from the drive in an
> > + * attempt to complete the data xfer. (see BZ#13399)
> > + */
> > + if (!(stat & ATA_ERR) && !uptodate && thislen) {
> > + ide_pio_bytes(drive, cmd, write, thislen);
> > + uptodate = cmd->nleft ? 0 : 1;
> > + }
> > +
> > + if (!uptodate)
> > rq->cmd_flags |= REQ_FAILED;
> > }
> > goto out_end;
--
Regards/Gruss,
Boris.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ide-cd: handle fragmented packet commands gracefully
2009-06-26 8:19 ` Borislav Petkov
@ 2009-06-26 16:23 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-06-26 16:23 UTC (permalink / raw)
To: petkovbb; +Cc: bzolnier, linux-ide, linux-kernel
From: Borislav Petkov <petkovbb@googlemail.com>
Date: Fri, 26 Jun 2009 10:19:58 +0200
> Hi David,
>
> On Mon, Jun 22, 2009 at 11:50:22AM +0200, Bartlomiej Zolnierkiewicz wrote:
>> On Sunday 21 June 2009 10:55:27 Borislav Petkov wrote:
>> > There are some devices in the wild that clear the DRQ bit during the
>> > last word of a packet command and therefore could use a "second chance"
>> > for that last word of data to be xferred instead of simply failing the
>> > request. Do that by attempting to suck in those last bytes in PIO mode.
>> >
>> > In addition, the ATA_ERR bit has to be cleared for we cannot be sure the
>> > data is valid otherwise.
>> >
>> > See http://bugzilla.kernel.org/show_bug.cgi?id=13399 for details.
>> >
>> > Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
>>
>> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>
> can you pick that one too, please. I can't seem to find it on patchwork.
Yep, I'll dig into the archives to get it, I had this on my TODO
list.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-26 16:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-21 8:55 [PATCH] ide-cd: handle fragmented packet commands gracefully Borislav Petkov
2009-06-22 9:50 ` Bartlomiej Zolnierkiewicz
2009-06-26 8:19 ` Borislav Petkov
2009-06-26 16:23 ` David Miller
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).