mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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)
This commit is contained in:
parent
9078f61c55
commit
de1cab2b60
1 changed files with 6 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue