Commit 0ed0283f authored by Dinghao Liu's avatar Dinghao Liu Committed by Jens Axboe

sata_dwc_460ex: Fix missing check in sata_dwc_isr

The return value of ata_qc_from_tag() is checked in the whole
kernel except for two calls in sata_dwc_isr(), which may lead
to null-pointer-dereference. Add return value checks to avoid
such case.
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9a9d3abe
...@@ -543,6 +543,11 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance) ...@@ -543,6 +543,11 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance)
hsdev->sactive_issued |= qcmd_tag_to_mask(tag); hsdev->sactive_issued |= qcmd_tag_to_mask(tag);
qc = ata_qc_from_tag(ap, tag); qc = ata_qc_from_tag(ap, tag);
if (unlikely(!qc)) {
dev_err(ap->dev, "failed to get qc");
handled = 1;
goto DONE;
}
/* /*
* Start FP DMA for NCQ command. At this point the tag is the * Start FP DMA for NCQ command. At this point the tag is the
* active tag. It is the tag that matches the command about to * active tag. It is the tag that matches the command about to
...@@ -658,6 +663,11 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance) ...@@ -658,6 +663,11 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance)
tag_mask &= (~0x00000001); tag_mask &= (~0x00000001);
qc = ata_qc_from_tag(ap, tag); qc = ata_qc_from_tag(ap, tag);
if (unlikely(!qc)) {
dev_err(ap->dev, "failed to get qc");
handled = 1;
goto DONE;
}
/* To be picked up by completion functions */ /* To be picked up by completion functions */
qc->ap->link.active_tag = tag; qc->ap->link.active_tag = tag;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment