The driver may sleep under a mutex, and the code path is:
aac_alloc_commands [line 1223: acquire the mutex]
aac_alloc_commands [line 1227]
  bus_dmamap_create(BUS_DMA_WAITOK) [line 1250] --> 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 <[email protected]>
---
 sys/dev/aacraid/aacraid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c
index 42a16c42039..b0a987f5903 100644
--- a/sys/dev/aacraid/aacraid.c
+++ b/sys/dev/aacraid/aacraid.c
@@ -1247,7 +1247,7 @@ aac_alloc_commands(struct aac_softc *sc)
                }
                cm->cm_index = sc->total_fibs;
 
-               if ((error = bus_dmamap_create(sc->aac_buffer_dmat, 0,
+               if ((error = bus_dmamap_create(sc->aac_buffer_dmat, 
BUS_DMA_NOWAIT,
                                               &cm->cm_datamap)) != 0)
                        break;
                if (sc->aac_max_fibs <= 1 || sc->aac_max_fibs - sc->total_fibs 
> 1)
-- 
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