Bug 220095 - [scsi] sys/dev/dpt/dpt_scsi.c: a sleep-under-mutex bug in dpt_init
Summary: [scsi] sys/dev/dpt/dpt_scsi.c: a sleep-under-mutex bug in dpt_init
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-18 03:31 UTC by Jia-Ju Bai
Modified: 2017-06-18 11:53 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jia-Ju Bai 2017-06-18 03:31:31 UTC
The driver may sleep under a mutex, and the function call path in file "sys/dev/dpt/dpt_scsi.c" in FreeBSD 11.0 is:
dpt_init [line 1246: acquire the mutex]
  dptallocsgmap [line 1282]
    bus_dmamap_load(BUS_DMA_WAITOK) [line 323] --> may sleep

The possible fix of this bug is to set the last parameter in bus_dmamap_load to "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.

Thanks,
Jia-Ju Bai
Comment 1 Jia-Ju Bai 2017-06-18 11:53:19 UTC
I have read the manual page of bus_dmamap_load.
This call will always return immediately and will not block for any reason.
Sorry for my wrong report, please ignore it.