[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210301072842.7410-1-dinghao.liu@zju.edu.cn>
Date:   Mon,  1 Mar 2021 15:28:42 +0800
From:   Dinghao Liu <dinghao.liu@....edu.cn>
To:     dinghao.liu@....edu.cn, kjlu@....edu
Cc:     Jens Axboe <axboe@...nel.dk>, linux-ide@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] sata_dwc_460ex: Fix missing check in sata_dwc_isr
ata_qc_from_tag() may return a null pointer and further lead to
null-pointer-dereference. Add a return value check to avoid such case.
Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
 drivers/ata/sata_dwc_460ex.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 9dcef6ac643b..0068247ffc06 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -548,8 +548,10 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance)
 		 * active tag.  It is the tag that matches the command about to
 		 * be completed.
 		 */
-		qc->ap->link.active_tag = tag;
-		sata_dwc_bmdma_start_by_tag(qc, tag);
+		if (qc) {
+			qc->ap->link.active_tag = tag;
+			sata_dwc_bmdma_start_by_tag(qc, tag);
+		}
 
 		handled = 1;
 		goto DONE;
-- 
2.17.1
Powered by blists - more mailing lists
 
