Commit 654eaaa3 authored by Sebastian Smolorz via Xenomai's avatar Sebastian Smolorz via Xenomai Committed by Jan Kiszka

net/tcp: Copy data back to user buffer in rt_tcp_recvmsg

A bug in rt_tcp_recvmsg() prevented an application to receive data
over an RTTCP socket. Data was not copied back to the application's
buffer but rather into a temporary kernel buffer.
Signed-off-by: 's avatarSebastian Smolorz <sebastian.smolorz@gmx.de>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent cd60d0da
......@@ -2084,17 +2084,10 @@ static ssize_t rt_tcp_recvmsg(struct rtdm_fd *fd, struct user_msghdr *msg, int m
len = iov[0].iov_len;
if (len > 0) {
buf = xnmalloc(len);
if (buf == NULL) {
ret = -ENOMEM;
goto out;
}
ret = rtdm_copy_from_user(fd, buf, iov[0].iov_base, len);
if (!ret)
ret = rt_tcp_read(fd, buf, len);
xnfree(buf);
buf = iov[0].iov_base;
ret = rt_tcp_read(fd, buf, len);
}
out:
rtdm_drop_iovec(iov, iov_fast);
return ret;
......
Markdown is supported
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