Date: Mon, 19 Jun 2017 09:11:13 +0800 From: Jia-Ju Bai <baijiaju1990@163.com> To: freebsd-drivers@freebsd.org, freebsd-bugs@freebsd.org, freebsd-scsi@freebsd.org Cc: Jia-Ju Bai <baijiaju1990@163.com> Subject: [PATCH] adwcam: Fix a possible sleep-under-mutex bug in adw_init Message-ID: <20170619011113.43652-1-baijiaju1990@163.com>
next in thread | raw e-mail | index | archive | help
The driver may sleep under a sleep, and the function call path is: adw_init [line 1098: acquire the mutex] adwallocacbs bus_dmamap_create(BUS_DMA_WAITOK) --> may sleep The possible fix of this bug is to replace "BUS_DMA_WAITOK" in bus_dmamap_create with "BUS_DMA_NOWAIT". This bug is found by a static analysis tool written by myself, and it is checked by my review of the FreeBSD code. Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com> --- sys/dev/advansys/adwcam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/advansys/adwcam.c b/sys/dev/advansys/adwcam.c index 02f9c49d800..6950ae49ff8 100644 --- a/sys/dev/advansys/adwcam.c +++ b/sys/dev/advansys/adwcam.c @@ -201,7 +201,7 @@ adwallocacbs(struct adw_softc *adw) for (i = 0; adw->num_acbs < adw->max_acbs && i < newcount; i++) { int error; - error = bus_dmamap_create(adw->buffer_dmat, /*flags*/0, + error = bus_dmamap_create(adw->buffer_dmat, /*flags*/BUS_DMA_NOWAIT, &next_acb->dmamap); if (error != 0) break; -- 2.13.0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170619011113.43652-1-baijiaju1990>