From 38c9c65ee409d75b243bbc3449a95dde2394cedd Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Thu, 30 Nov 2017 14:06:54 +0000 Subject: [PATCH] r326394 is calling malloc with M_WAITOK under a lock, revert for now Reported by: andrew --- sys/fs/devfs/devfs_dir.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/fs/devfs/devfs_dir.c b/sys/fs/devfs/devfs_dir.c index 0fb1e68fc7bd..d60f7a7c6372 100644 --- a/sys/fs/devfs/devfs_dir.c +++ b/sys/fs/devfs/devfs_dir.c @@ -98,18 +98,19 @@ devfs_dir_ref(const char *dir) if (*dir == '\0') return; + dle_new = malloc(sizeof(*dle), M_DEVFS4, M_WAITOK); + dle_new->dir = strdup(dir, M_DEVFS4); + dle_new->refcnt = 1; + mtx_lock(&dirlist_mtx); dle = devfs_dir_findent_locked(dir); if (dle != NULL) { dle->refcnt++; mtx_unlock(&dirlist_mtx); + free(dle_new->dir, M_DEVFS4); + free(dle_new, M_DEVFS4); return; } - - dle_new = malloc(sizeof(*dle), M_DEVFS4, M_WAITOK); - dle_new->dir = strdup(dir, M_DEVFS4); - dle_new->refcnt = 1; - LIST_INSERT_HEAD(&devfs_dirlist, dle_new, link); mtx_unlock(&dirlist_mtx); }