sock: copy msgctrl to msg header

This commit is contained in:
Matheus
2024-08-31 20:30:06 -03:00
parent 2f0b43822b
commit fe6d72a7c3
+21
View File
@@ -125,6 +125,25 @@ static inline int sock_copymsghdr(msghdr_t *khdr, msghdr_t *uhdr) {
khdr->addr = addrtmp;
}
if (khdr->msgctrl) {
void *ctrltmp = alloc(khdr->ctrllen);
if (ctrltmp == NULL) {
if (khdr->addr)
free(khdr->addr);
free(iovectmp);
return ENOMEM;
}
if (usercopy_fromuser(ctrltmp, khdr->msgctrl, khdr->ctrllen)) {
if (khdr->addr)
free(khdr->addr);
free(iovectmp);
return EFAULT;
}
khdr->msgctrl = ctrltmp;
}
return 0;
}
@@ -132,6 +151,8 @@ static inline void sock_freemsghdr(msghdr_t *hdr) {
free(hdr->iov);
if (hdr->addr)
free(hdr->addr);
if (hdr->msgctrl)
free(hdr->msgctrl);
}
void localsock_leavebinding(vnode_t *vnode);