* [PATCH] scsi: hisi_sas: add null check before indirect pointer dereference
@ 2017-05-22 18:00 Gustavo A. R. Silva
2017-05-23 7:43 ` John Garry
2017-05-24 2:03 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-05-22 18:00 UTC (permalink / raw)
To: John Garry, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva
Add null check before indirectly dereferencing pointer task->lldd_task
in statement u32 tag = slot->idx;
Addresses-Coverity-ID: 1373843
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index d622db5..f720d3c 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -963,7 +963,7 @@ static int hisi_sas_abort_task(struct sas_task *task)
HISI_SAS_INT_ABT_DEV, 0);
rc = hisi_sas_softreset_ata_disk(device);
}
- } else if (task->task_proto & SAS_PROTOCOL_SMP) {
+ } else if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SMP) {
/* SMP */
struct hisi_sas_slot *slot = task->lldd_task;
u32 tag = slot->idx;
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] scsi: hisi_sas: add null check before indirect pointer dereference
2017-05-22 18:00 [PATCH] scsi: hisi_sas: add null check before indirect pointer dereference Gustavo A. R. Silva
@ 2017-05-23 7:43 ` John Garry
2017-05-24 2:03 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: John Garry @ 2017-05-23 7:43 UTC (permalink / raw)
To: Gustavo A. R. Silva, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel
On 22/05/2017 19:00, Gustavo A. R. Silva wrote:
> Add null check before indirectly dereferencing pointer task->lldd_task
> in statement u32 tag = slot->idx;
>
I don't think that this is a valid scenario, but protecting against a
possible NULL dereference is prudent. Thanks
> Addresses-Coverity-ID: 1373843
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: John Garry <john.garry@huawei.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: hisi_sas: add null check before indirect pointer dereference
2017-05-22 18:00 [PATCH] scsi: hisi_sas: add null check before indirect pointer dereference Gustavo A. R. Silva
2017-05-23 7:43 ` John Garry
@ 2017-05-24 2:03 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-05-24 2:03 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel
Gustavo A.,
> Add null check before indirectly dereferencing pointer task->lldd_task
> in statement u32 tag = slot->idx;
Applied to 4.13/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-24 2:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 18:00 [PATCH] scsi: hisi_sas: add null check before indirect pointer dereference Gustavo A. R. Silva
2017-05-23 7:43 ` John Garry
2017-05-24 2:03 ` Martin K. Petersen
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).