[Bug 219986] [mly] sys/dev/mly/mly.c: a sleep-under-mutex bug in mly_user_command

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jun 14 14:20:46 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219986

            Bug ID: 219986
           Summary: [mly] sys/dev/mly/mly.c: a sleep-under-mutex bug in
                    mly_user_command
           Product: Base System
           Version: 11.0-RELEASE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: baijiaju1990 at 163.com

The mly driver may sleep under a mutex, and the function call path in file
"sys/dev/mly/mly.c" in FreeBSD 11.0 is:
mly_user_command [line 2925: acquire the mutex]
  mly_start [line 2926]
    mly_map_command [line 1489]
      bus_dmamap_load_ccb(BUS_DMA_WAITOK) [line 1880] --> may sleep
      bus_dmamap_load(BUS_DMA_WAITOK) [line 1883] --> may sleep

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

By the way, I am a freshman in developing FreeBSD drivers, and I am willing to
submit a patch to fix this bug. But I do not know how to write and submit a
patch, and where to submit, so I am looking forward to useful advice :)

Jia-Ju Bai

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list