* [Qemu-devel] [PATCH] scsi: megasas: check request object in MegasasCmd
@ 2017-05-10 11:13 P J P
2017-05-10 14:51 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: P J P @ 2017-05-10 11:13 UTC (permalink / raw)
To: Qemu Developers; +Cc: Paolo Bonzini, Zhangyanyu, Prasad J Pandit
From: Prasad J Pandit <pjp@fedoraproject.org>
When processing completed commands, if SCSIRequest object
'cmd->req' was null, it could lead to null pointer dereference
in megasas_complete_command. Add check to avoid it.
Reported-by: Zhangyanyu <zyy4013@stu.ouc.edu.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
hw/scsi/megasas.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 84b8caf..25e3541 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -580,9 +580,11 @@ static void megasas_complete_command(MegasasCmd *cmd)
cmd->iov_size = 0;
cmd->iov_offset = 0;
- cmd->req->hba_private = NULL;
- scsi_req_unref(cmd->req);
- cmd->req = NULL;
+ if (cmd->req) {
+ cmd->req->hba_private = NULL;
+ scsi_req_unref(cmd->req);
+ cmd->req = NULL;
+ }
megasas_unmap_frame(cmd->state, cmd);
megasas_complete_frame(cmd->state, cmd->context);
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] scsi: megasas: check request object in MegasasCmd
2017-05-10 11:13 [Qemu-devel] [PATCH] scsi: megasas: check request object in MegasasCmd P J P
@ 2017-05-10 14:51 ` Paolo Bonzini
2017-05-10 17:14 ` P J P
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2017-05-10 14:51 UTC (permalink / raw)
To: P J P, Qemu Developers; +Cc: Zhangyanyu, Prasad J Pandit
On 10/05/2017 13:13, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
>
> When processing completed commands, if SCSIRequest object
> 'cmd->req' was null, it could lead to null pointer dereference
> in megasas_complete_command. Add check to avoid it.
>
> Reported-by: Zhangyanyu <zyy4013@stu.ouc.edu.cn>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
What version was this reported for? It should be fixed in v2.8.0 and
newer by commit 9e55d58806 ("megasas: clean up and fix request
completion/cancellation", 2016-11-28).
Thanks,
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] scsi: megasas: check request object in MegasasCmd
2017-05-10 14:51 ` Paolo Bonzini
@ 2017-05-10 17:14 ` P J P
0 siblings, 0 replies; 3+ messages in thread
From: P J P @ 2017-05-10 17:14 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Qemu Developers, Zhangyanyu
Hello Paolo,
+-- On Wed, 10 May 2017, Paolo Bonzini wrote --+
| What version was this reported for? It should be fixed in v2.8.0 and
| newer by commit 9e55d58806 ("megasas: clean up and fix request
| completion/cancellation", 2016-11-28).
I checked the reproducer against current upstream git, it does work. IIUC, the
above commit appears to have introduced the issue.
Thank you.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-10 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 11:13 [Qemu-devel] [PATCH] scsi: megasas: check request object in MegasasCmd P J P
2017-05-10 14:51 ` Paolo Bonzini
2017-05-10 17:14 ` P J P
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.