From: Viswas G <Viswas.G@xxxxxxxxxxxxx> commit 0b6df110b3d0c12562011fcd032cfb6ff16b6d56 upstream when there's an error in 'ncq mode' the host has to read the ncq error log (10h) to clear the error state. however, the ccb that is setup for doing this doesn't setup the ccb so that the previous state is cleared. if the ccb was previously used for an IO n_elems is set and pm8001_ccb_task_free() treats this as the signal to go free a scatter-gather list (that's already been freed). Signed-off-by: Deepak Ukey <deepak.ukey@xxxxxxxxxxxxx> Signed-off-by: Viswas G <Viswas.G@xxxxxxxxxxxxx> Acked-by: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> --- drivers/scsi/pm8001/pm80xx_hwi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 8627feb80261..bd945d832eb8 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1500,8 +1500,9 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, ccb->ccb_tag = ccb_tag; ccb->task = task; ccb->n_elem = 0; - pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG; - pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; + pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG; // set this flag to indicate read log + pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; // set this flag to guard against 2nd RLE. Workaround + // till FW fix is available. memset(&sata_cmd, 0, sizeof(sata_cmd)); circularQ = &pm8001_ha->inbnd_q_tbl[0]; -- 2.17.1