Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145613037
D26298.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26298.diff
View Options
Index: head/sys/kern/uipc_usrreq.c
===================================================================
--- head/sys/kern/uipc_usrreq.c
+++ head/sys/kern/uipc_usrreq.c
@@ -1557,7 +1557,8 @@
unp_connectat(int fd, struct socket *so, struct sockaddr *nam,
struct thread *td)
{
- struct sockaddr_un *soun = (struct sockaddr_un *)nam;
+ struct mtx *vplock;
+ struct sockaddr_un *soun;
struct vnode *vp;
struct socket *so2;
struct unpcb *unp, *unp2, *unp3;
@@ -1566,7 +1567,7 @@
struct sockaddr *sa;
cap_rights_t rights;
int error, len, freed;
- struct mtx *vplock;
+ bool connreq;
if (nam->sa_family != AF_UNIX)
return (EAFNOSUPPORT);
@@ -1575,6 +1576,7 @@
len = nam->sa_len - offsetof(struct sockaddr_un, sun_path);
if (len <= 0)
return (EINVAL);
+ soun = (struct sockaddr_un *)nam;
bcopy(soun->sun_path, buf, len);
buf[len] = 0;
@@ -1587,7 +1589,11 @@
unp->unp_flags |= UNP_CONNECTING;
UNP_PCB_UNLOCK(unp);
- sa = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK);
+ connreq = (so->so_proto->pr_flags & PR_CONNREQUIRED) != 0;
+ if (connreq)
+ sa = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK);
+ else
+ sa = NULL;
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
UIO_SYSSPACE, buf, fd, cap_rights_init(&rights, CAP_CONNECTAT), td);
error = namei(&nd);
@@ -1628,7 +1634,7 @@
error = EPROTOTYPE;
goto bad2;
}
- if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
+ if (connreq) {
if (so2->so_options & SO_ACCEPTCONN) {
CURVNET_SET(so2->so_vnet);
so2 = sonewconn(so2, 0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 23, 4:33 AM (11 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28950774
Default Alt Text
D26298.diff (1 KB)
Attached To
Mode
D26298: [unix(4) cleanup 5/8] Avoid an unnecessary malloc() for dgram sockets.
Attached
Detach File
Event Timeline
Log In to Comment