aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2017-11-30 14:06:54 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2017-11-30 14:06:54 +0000
commit38c9c65ee409d75b243bbc3449a95dde2394cedd (patch)
tree79125c11182055016607ff69ce285f2b8bea209a /sys
parent31e8b07376cebdb87648d977a2f1c10e024b67d0 (diff)
downloadsrc-38c9c65ee409d75b243bbc3449a95dde2394cedd.tar.gz
src-38c9c65ee409d75b243bbc3449a95dde2394cedd.zip
r326394 is calling malloc with M_WAITOK under a lock, revert for now
Reported by: andrew
Notes
Notes: svn path=/head/; revision=326395
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/devfs/devfs_dir.c11
1 files 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);
}