[Bug 220094] [scsi] sys/cam/scsi/scsi_sa.c: a sleep-under-mutex bug in saioctl

Jia-Ju Bai baijiaju1990 at 163.com
Sun Jun 18 03:19:44 UTC 2017


The driver may sleep under a mutex, and the function call path in file 
"sys/cam/scsi/scsi_sa.c" in FreeBSD 11.0 is:
saioctl [line 1680: acquire the mutex]
   saextget [line 1683]
     malloc(M_WAITOK) [line 4444] --> may sleep

The possible fix of this bug is to replace "M_WAITOK" in malloc with 
"M_NOWAIT".

This bug is found by a static analysis tool written by myself, and it is 
checked by my review of the FreeBSD code.

Thanks,
Jia-Ju Bai



More information about the freebsd-drivers mailing list