[PATCH v4] usb: dwc2: host: Fix use after free w/ simultaneous irqs

Doug Anderson dianders at chromium.org
Mon Oct 19 09:36:26 PDT 2015


John,

On Fri, Oct 16, 2015 at 9:14 PM, John Youn <John.Youn at synopsys.com> wrote:
> I reviewed this some more and I think this should be ok. Most of
> the handlers don't make sense without a qtd and/or channel.
>
> Although I am not completely sure on the desc dma case. I think
> it will at least be better than letting the use-after-free occur.
>
>
> Acked-by: John Youn <johnyoun at synopsys.com>

Thanks!

I put some code in to give a stack crawl for the cause of the NULL
"qh" case.  I'm running with Gregory Herrero's Descriptor DMA series.
NULL case only happens if I move "dma_desc_enable" and
"dma_desc_fs_enable" away from 0 (right now Rockchip is hardcoded to
have dma_desc off).

--

kgdb shows:

#0  0xc0198728 in arch_kgdb_breakpoint () at
arch/arm/include/asm/outercache.h:103

#1  kgdb_breakpoint () at kernel/debug/debug_core.c:1054

#2  0xc0462dcc in dwc2_release_channel_ddma
(hsotg=hsotg at entry=0xed426058, qh=qh at entry=0xed682280) at
drivers/usb/dwc2/hcd_ddma.c:318

...AKA on "chan->qh = NULL;"


#3  0xc0463f48 in dwc2_hcd_complete_xfer_ddma
(hsotg=hsotg at entry=0xed426058, chan=chan at entry=0xed531a40,
chnum=chnum at entry=0,
halt_status=halt_status at entry=DWC2_HC_XFER_COMPLETE)
    at drivers/usb/dwc2/hcd_ddma.c:1351

#4  0xc0460414 in dwc2_hc_xfercomp_intr (hsotg=hsotg at entry=0xed426058,
chan=chan at entry=0xed531a40, chnum=chnum at entry=0,
qtd=qtd at entry=0xed66cc00)
    at drivers/usb/dwc2/hcd_intr.c:1002

#5  0xc0461814 in dwc2_hc_chhltd_intr_dma (qtd=0xed66cc00, chnum=0,
chan=0xed531a40, hsotg=0xed426058) at drivers/usb/dwc2/hcd_intr.c:1830

#6  dwc2_hc_chhltd_intr (qtd=0xed66cc00, chnum=0, chan=0xed531a40,
hsotg=0xed426058) at drivers/usb/dwc2/hcd_intr.c:1951

#7  dwc2_hc_n_intr (chnum=0, hsotg=0xed426058) at
drivers/usb/dwc2/hcd_intr.c:2063

...AKA on "dwc2_hc_chhltd_intr(hsotg, chan, chnum, qtd);"

#8  dwc2_hc_intr (hsotg=0xed426058) at drivers/usb/dwc2/hcd_intr.c:2138

#9  dwc2_handle_hcd_intr (hsotg=0xed426058) at drivers/usb/dwc2/hcd_intr.c:2188

#10 0xc045c22c in _dwc2_hcd_irq (hcd=<optimized out>) at
drivers/usb/dwc2/hcd.c:2895

#11 0xc044752c in usb_hcd_irq (irq=<optimized out>, __hcd=<optimized
out>) at drivers/usb/core/hcd.c:2353


-Doug



More information about the Linux-rockchip mailing list