Commit 8764cf4b authored by Mikhail Karpenko's avatar Mikhail Karpenko
Browse files

Add a workaround patch to fix kernel panic after ESATA disk connection

parent 8fc41ee4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
Patches from this directory are applied by 'meta-elphel393/recipes-kernel/linux/linux-xlnx' bitbake recipe. To add a new patch, append SRC_URI variable in the recipe.
Short description of the paches:

libata-eh.c.patch
	This patch is a workaround for the situation when ESATA disk connection leads to kernel panic. Consider the following execution path in driver: libata-core.c:ata_exec_internal_sg -> error during command execution leading to command timeout -> libata-core.c:ata_qc_complete (or ata_port_freeze and finally to the same function) -> libata-core.c:ata_qc_schedule_eh where qc->scsicmd is a NULL pointer by the moment. This patch may not be needed when all hardware/software issues are rectified.
+29 −0
Original line number Diff line number Diff line
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d2029a4..3fdf705 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -968,7 +968,7 @@ static void ata_eh_set_pending(struct ata_port *ap, int fastdrain)
 void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
-	struct request_queue *q = qc->scsicmd->device->request_queue;
+	struct request_queue *q;
 	unsigned long flags;
 
 	WARN_ON(!ap->ops->error_handler);
@@ -981,9 +981,12 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
 	 * Note that ATA_QCFLAG_FAILED is unconditionally set after
 	 * this function completes.
 	 */
-	spin_lock_irqsave(q->queue_lock, flags);
-	blk_abort_request(qc->scsicmd->request);
-	spin_unlock_irqrestore(q->queue_lock, flags);
+	if (qc->scsicmd != NULL) {
+		q = qc->scsicmd->device->request_queue;
+		spin_lock_irqsave(q->queue_lock, flags);
+		blk_abort_request(qc->scsicmd->request);
+		spin_unlock_irqrestore(q->queue_lock, flags);
+	}
 }
 
 /**