Skip to content

Commit 9c72ebe

Browse files
Borislav Petkovdavem330
authored andcommitted
ide-cd: handle fragmented packet commands gracefully
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5e95524 commit 9c72ebe

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎drivers/ide/ide-cd.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
592592
}
593593
} else if (!blk_pc_request(rq)) {
594594
ide_cd_request_sense_fixup(drive, cmd);
595-
/* complain if we still have data left to transfer */
595+
596596
uptodate = cmd->nleft ? 0 : 1;
597-
if (uptodate == 0)
597+
598+
/*
599+
* suck out the remaining bytes from the drive in an
600+
* attempt to complete the data xfer. (see BZ#13399)
601+
*/
602+
if (!(stat & ATA_ERR) && !uptodate && thislen) {
603+
ide_pio_bytes(drive, cmd, write, thislen);
604+
uptodate = cmd->nleft ? 0 : 1;
605+
}
606+
607+
if (!uptodate)
598608
rq->cmd_flags |= REQ_FAILED;
599609
}
600610
goto out_end;

0 commit comments

Comments
 (0)