mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
Fix two oversights here: don't trash the freelist, and properly cleanup
the cdevsw{}. Submitted by: tegge
This commit is contained in:
parent
05efcb983c
commit
652d04726d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126156
|
@ -287,6 +287,7 @@ allocdev(void)
|
|||
|
||||
if (LIST_FIRST(&dev_free)) {
|
||||
si = LIST_FIRST(&dev_free);
|
||||
LIST_REMOVE(si, si_hash);
|
||||
} else if (stashed >= DEVT_STASH) {
|
||||
MALLOC(si, struct cdev *, sizeof(*si), M_DEVT,
|
||||
M_USE_RESERVE | M_ZERO | M_WAITOK);
|
||||
|
@ -399,7 +400,9 @@ fini_cdevsw(struct cdevsw *devsw)
|
|||
reserved_majors[devsw->d_maj] = 0;
|
||||
devsw->d_maj = MAJOR_AUTO;
|
||||
devsw->d_flags &= ~D_ALLOCMAJ;
|
||||
}
|
||||
} else if (devsw->d_maj == 0)
|
||||
devsw->d_maj = 256;
|
||||
devsw->d_flags &= ~D_INIT;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue