linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sata_dwc_460ex: Fix missing check in sata_dwc_isr
@ 2021-03-01  7:28 Dinghao Liu
  2021-03-01 10:31 ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Dinghao Liu @ 2021-03-01  7:28 UTC (permalink / raw)
  To: dinghao.liu, kjlu; +Cc: Jens Axboe, linux-ide, linux-kernel

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@zju.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-03 22:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01  7:28 [PATCH] sata_dwc_460ex: Fix missing check in sata_dwc_isr Dinghao Liu
2021-03-01 10:31 ` Andy Shevchenko
2021-03-01 11:20   ` dinghao.liu
2021-03-01 13:47     ` Andy Shevchenko
2021-03-02  7:33       ` dinghao.liu
2021-03-02 10:20         ` Andy Shevchenko
2021-03-03  5:21           ` dinghao.liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).