[Bug 280651] [patch] nmdm: Allow module to be force-unloaded

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 06 Aug 2024 10:23:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280651

            Bug ID: 280651
           Summary: [patch] nmdm: Allow module to be force-unloaded
           Product: Base System
           Version: 13.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: megamansec@gmail.com

Created attachment 252541
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=252541&action=edit
Fix double lock and typo and incorrect order of locking

If an nmdm device was created by accident such as by running
ls /dev/nmdmAA, it would restrict the module from being unloaded,
despite no data passing through it.

With this patch, kldunload nmdm will still fail if any nmdm device still
exists.

kldunload -f nmdm will try to destroy all nmdm devices before unloading.
If an nmdm modem is either opened in blocking mode or data is being
passed through it, after five seconds of trying, it will not be destroyed
and the unload will also fail.

Likewise, fix an incorrect tty_lock, a typo, and the order of locking.

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