Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jun 2017 11:04:25 +0100
From:      "N.J. Mann" <njm@njm.me.uk>
To:        Jia-Ju Bai <baijiaju1990@163.com>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: [Bug 220095][PATCH] dpt_scsi: Fix a possible sleep-under-mutex bug in dpt_init
Message-ID:  <7D8CD40C6A8CDF922B1E15A8@triton.njm.me.uk>
In-Reply-To: <20170618094601.40636-1-baijiaju1990@163.com>
References:  <20170618094601.40636-1-baijiaju1990@163.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,


On Sunday, June 18, 2017 17:46:01 +0800 Jia-Ju Bai <baijiaju1990@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.
-- 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7D8CD40C6A8CDF922B1E15A8>