All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/scsi/megasas: check for NULL frame in megasas_command_cancelled()
@ 2020-12-24 17:54 Mauro Matteo Cascella
  2021-01-13  5:45 ` Alexander Bulekov
  2021-01-25 14:22 ` Mauro Matteo Cascella
  0 siblings, 2 replies; 5+ messages in thread
From: Mauro Matteo Cascella @ 2020-12-24 17:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: cwmyung, hare, mcascell, qemu-block

Ensure that 'cmd->frame' is not NULL before accessing the 'header' field.
This check prevents a potential NULL pointer dereference issue.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1910346
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reported-by: Cheolwoo Myung <cwmyung@snu.ac.kr>
---
 hw/scsi/megasas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 1a5fc5857d..77510e120c 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -1893,7 +1893,7 @@ static void megasas_command_cancelled(SCSIRequest *req)
 {
     MegasasCmd *cmd = req->hba_private;
 
-    if (!cmd) {
+    if (!cmd || !cmd->frame) {
         return;
     }
     cmd->frame->header.cmd_status = MFI_STAT_SCSI_IO_FAILED;
-- 
2.29.2



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

end of thread, other threads:[~2021-01-26  8:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24 17:54 [PATCH] hw/scsi/megasas: check for NULL frame in megasas_command_cancelled() Mauro Matteo Cascella
2021-01-13  5:45 ` Alexander Bulekov
2021-01-25 14:22 ` Mauro Matteo Cascella
2021-01-25 14:52   ` Philippe Mathieu-Daudé
2021-01-26  8:36     ` Mauro Matteo Cascella

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.