Bug 220238

Summary: sys/dev/tws/tws.c: A possible sleep-under-mutex bug in tws_init_reqs
Product: Base System Reporter: Jia-Ju Bai <baijiaju1990>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Jia-Ju Bai 2017-06-24 03:16:34 UTC
The driver may sleep under a mutex, and code path is:
tws_init_reqs [line 684: acquire the mutex]
tws_init_reqs [line 685]
  bus_dmamap_create(BUS_DMA_WAITOK) [line 687] --> may sleep

The possible fix of this bug is to replace the "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.