[Bug 220095][PATCH] dpt_scsi: Fix a possible sleep-under-mutex bug in dpt_init

N.J. Mann njm at njm.me.uk
Sun Jun 18 10:11:10 UTC 2017


Hi,


On Sunday, June 18, 2017 17:46:01 +0800 Jia-Ju Bai <baijiaju1990 at 163.com> wrote:
> The driver may sleep under a mutex, and the function call path is:
> dpt_init [acquire the mutex]
>    dptallocsgmap
>      bus_dmamap_load(BUS_DMA_WAITOK) --> may sleep
> 
> The possible fix of this bug is to set the last parameter in 
> bus_dmamap_load to "BUS_DMA_NOWAIT".

Have you read the manual page for bus_dmamap_load() ?

    bus_dmamap_load(dmat, map, buf, buflen, *callback, callback_arg, flags)
            Creates a mapping in device visible address space of buflen bytes
            of buf, associated with the DMA map map.  This call will always
            return immediately and will not block for any reason.

I am not saying that your change should not be made, just that your analysis
may be wrong.


Cheers,
       Nick.
-- 



More information about the freebsd-drivers mailing list