qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usb: ehci: add capability mmio write function
@ 2016-01-29 13:00 P J P
  2016-01-29 13:45 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: P J P @ 2016-01-29 13:00 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Zuozhi Fzz, Gerd Hoffmann, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

USB Ehci emulation supports host controller capability registers.
But its mmio '.write' function was missing, which lead to a null
pointer dereference issue. Add a do nothing 'ehci_caps_write'
definition to avoid it; Do nothing because capability registers
are Read Only(RO).

Reported-by: Zuozhi Fzz <zuozhi.fzz@alibaba-inc.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/usb/hcd-ehci.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index c40013e..b08ff62 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -893,6 +893,11 @@ static uint64_t ehci_caps_read(void *ptr, hwaddr addr,
     return s->caps[addr];
 }
 
+static void ehci_caps_write(void *ptr, hwaddr addr,
+                             uint64_t val, unsigned size)
+{
+}
+
 static uint64_t ehci_opreg_read(void *ptr, hwaddr addr,
                                 unsigned size)
 {
@@ -2313,6 +2318,7 @@ static void ehci_frame_timer(void *opaque)
 
 static const MemoryRegionOps ehci_mmio_caps_ops = {
     .read = ehci_caps_read,
+    .write = ehci_caps_write,
     .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .impl.min_access_size = 1,
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH] usb: ehci: add capability mmio write function
  2016-01-29 13:00 [Qemu-devel] [PATCH] usb: ehci: add capability mmio write function P J P
@ 2016-01-29 13:45 ` Gerd Hoffmann
  2016-01-29 16:48   ` P J P
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2016-01-29 13:45 UTC (permalink / raw)
  To: P J P; +Cc: Zuozhi Fzz, QEMU Developers, Prasad J Pandit

On Fr, 2016-01-29 at 18:30 +0530, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
> 
> USB Ehci emulation supports host controller capability registers.
> But its mmio '.write' function was missing, which lead to a null
> pointer dereference issue. Add a do nothing 'ehci_caps_write'
> definition to avoid it; Do nothing because capability registers
> are Read Only(RO).

Surely makes sense, xhci does the same, I'll pick it up.

Maybe we should have a generic nop_write function somewhere.  Not that
there can much go wrong by cut&pasting here, but still ...

cheers,
  Gerd

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

* Re: [Qemu-devel] [PATCH] usb: ehci: add capability mmio write function
  2016-01-29 13:45 ` Gerd Hoffmann
@ 2016-01-29 16:48   ` P J P
  0 siblings, 0 replies; 3+ messages in thread
From: P J P @ 2016-01-29 16:48 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Zuozhi Fzz, QEMU Developers, Prasad J Pandit

   Hello Gerd,

+-- On Fri, 29 Jan 2016, Gerd Hoffmann wrote --+
| On Fr, 2016-01-29 at 18:30 +0530, P J P wrote:
| > pointer dereference issue. Add a do nothing 'ehci_caps_write'
| > definition to avoid it; Do nothing because capability registers
| > are Read Only(RO).
| 
| Surely makes sense, xhci does the same, I'll pick it up.

  Cool! Thank you.
 
| Maybe we should have a generic nop_write function somewhere.  Not that there

  True. Would one nop_write function serve them all? I mean do they share the 
same prototype/syntax?

--
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:[~2016-01-29 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 13:00 [Qemu-devel] [PATCH] usb: ehci: add capability mmio write function P J P
2016-01-29 13:45 ` Gerd Hoffmann
2016-01-29 16:48   ` P J P

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).