diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2003-05-29 18:36:26 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2003-05-29 18:36:26 +0000 |
commit | a02706ac9315f0d50e6a05572a574d74c2eb84d9 (patch) | |
tree | 6861175fdc34ba47fcb8015360f1e8beef3b43b4 /sys/kern/uipc_syscalls.c | |
parent | e330758d56bad341f3b6004687dae494c845e9f0 (diff) | |
download | FreeBSD-src-a02706ac9315f0d50e6a05572a574d74c2eb84d9.zip FreeBSD-src-a02706ac9315f0d50e6a05572a574d74c2eb84d9.tar.gz |
Grab giant in sendit rather than kern_sendit because sockargs may
allocate mbufs with M_TRYWAIT, which may require Giant.
Reviewed by: bmilekic
Approved by: re (scottl)
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index cf6ef69..1df7853 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -623,10 +623,13 @@ sendit(td, s, mp, flags) struct sockaddr *to; int error; + mtx_lock(&Giant); if (mp->msg_name != NULL) { error = getsockaddr(&to, mp->msg_name, mp->msg_namelen); - if (error) - return error; + if (error) { + to = NULL; + goto bad; + } mp->msg_name = to; } else to = NULL; @@ -669,6 +672,7 @@ sendit(td, s, mp, flags) bad: if (to) FREE(to, M_SONAME); + mtx_unlock(&Giant); return (error); } @@ -691,7 +695,6 @@ kern_sendit(td, s, mp, flags, control) int iovlen; #endif - mtx_lock(&Giant); if ((error = fgetsock(td, s, &so, NULL)) != 0) goto bad2; @@ -752,7 +755,6 @@ kern_sendit(td, s, mp, flags, control) bad: fputsock(so); bad2: - mtx_unlock(&Giant); return (error); } |