Thank you for fixing the problem.
On Thu, May 27, 2021 at 9:19 PM Jared McNeill <[email protected]> wrote: > > Good catch! I've committed a slightly modified version of your patch. > > Take care, > Jared > > > On Thu, 27 May 2021, [email protected] wrote: > > > hi, > > > > sometimes memories allocated by usb_allocmem with USBMALLOC_ZERO > > are not cleared. > > usb_block_allocmem, called from usb_allocmem, returns with valid dmap > > if it has found a block in usb_blk_freelist. In that path memset is not > > done. > > > > > > --- src/sys/dev/usb/usb_mem.c.orig 2021-01-05 22:12:39.913414469 +0000 > > +++ src/sys/dev/usb/usb_mem.c 2021-05-27 01:36:53.189148366 +0000 > > @@ -135,6 +135,11 @@ usb_block_allocmem(bus_dma_tag_t tag, si > > usb_blk_nfree--; > > *dmap = b; > > DPRINTFN(6, "free list size=%ju", b->size, 0, 0, 0); > > + if ((flags & USBMALLOC_ZERO) != 0) { > > + memset(b->kaddr, 0, b->size); > > + bus_dmamap_sync(b->tag, b->map, 0, b->size, > > + BUS_DMASYNC_PREWRITE); > > + } > > return 0; > > } > > } > > > >
