The driver may sleep under a mutex, and the code path is:
dpt_init [line 1134: acquire the mutex]
  bus_dma_tag_create(BUS_DMA_WAITOK) [line 1143] --> may sleep

The possible fix of this bug is to replace "BUS_DMA_WAITOK" in 
bus_dma_tag_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 <[email protected]>
---
 sys/dev/dpt/dpt_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c
index 541b58665cf..d69a443067a 100644
--- a/sys/dev/dpt/dpt_scsi.c
+++ b/sys/dev/dpt/dpt_scsi.c
@@ -1150,7 +1150,7 @@ dpt_init(struct dpt_softc *dpt)
                                /* maxsize      */ PAGE_SIZE,
                                /* nsegments    */ 1,
                                /* maxsegsz     */ BUS_SPACE_MAXSIZE_32BIT,
-                               /* flags        */ 0,
+                               /* flags        */ BUS_DMA_NOWAIT,
                                /* lockfunc     */ NULL,
                                /* lockarg      */ NULL,
                                &dpt->sg_dmat) != 0) {
-- 
2.13.0


_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to