Commit 78f32e29 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

net/packet: recvmsg: write back namelen only if name required

parent db8bfc34
......@@ -351,12 +351,6 @@ rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr *u_msg, int msg_flags)
rtskb = rtskb_dequeue_chain(&sock->incoming);
RTNET_ASSERT(rtskb != NULL, return -EFAULT;);
/* copy the address */
namelen = sizeof(sll);
ret = rtnet_put_arg(fd, &msg->msg_namelen, &namelen, sizeof(namelen));
if (ret)
goto fail;
/* copy the address if required. */
if (msg->msg_name) {
struct rtnet_device *rtdev = rtskb->rtdev;
......@@ -373,6 +367,11 @@ rt_packet_recvmsg(struct rtdm_fd *fd, struct user_msghdr *u_msg, int msg_flags)
ret = rtnet_put_arg(fd, msg->msg_name, &sll, sizeof(sll));
if (ret)
goto fail;
namelen = sizeof(sll);
ret = rtnet_put_arg(fd, &u_msg->msg_namelen, &namelen, sizeof(namelen));
if (ret)
goto fail;
}
/* Include the header in raw delivery */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment