scsi: mac_scsi: Treat Last Byte Sent time-out as failure [Linux 5.3]

This Linux kernel change "scsi: mac_scsi: Treat Last Byte Sent time-out as failure" is included in the Linux 5.3 release. This change is authored by Finn Thain <fthain [at]> on Sun Jun 9 11:19:11 2019 +1000. The commit for this change in Linux stable tree is 7c1f3e3 (patch).

scsi: mac_scsi: Treat Last Byte Sent time-out as failure

A system bus error during a PDMA send operation can result in bytes being
lost. Theoretically that could cause the target to remain in DATA OUT phase
and the initiator (expecting a phase change) would time-out waiting for the
Last Byte Sent flag. Should that happen, fail the transfer so the core
driver will stop using PDMA with this target.

Cc: Michael Schmitz <>
Signed-off-by: Finn Thain <>
Tested-by: Stan Johnson <>
Tested-by: Michael Schmitz <>
Signed-off-by: Martin K. Petersen <>

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/scsi/mac_scsi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index 8fbec17..658a719 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -360,9 +360,12 @@ static inline int macscsi_pwrite(struct NCR5380_hostdata *hostdata,
        if (hostdata->pdma_residual == 0) {
            if (NCR5380_poll_politely(hostdata, TARGET_COMMAND_REG,
-                                     TCR_LAST_BYTE_SENT, HZ / 64) < 0)
+                                     TCR_LAST_BYTE_SENT,
+                                     HZ / 64) < 0) {
                scmd_printk(KERN_ERR, hostdata->connected,
                            "%s: Last Byte Sent timeout\n", __func__);
+               result = -1;
+           }
            goto out;

Leave a Reply

Your email address will not be published. Required fields are marked *