]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: keep the skb in rcv queue until the whole data is read
authorXin Long <lucien.xin@gmail.com>
Fri, 16 Jul 2021 21:44:07 +0000 (17:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:27 +0000 (12:26 +0200)
commit4b1a335c80be4fdf72479538deb352bdccbb8447
treee568cfe368faa44cb4259235c064290ba686de50
parent87d247ace2bcd17d5a81676a0c13172936b63e8a
tipc: keep the skb in rcv queue until the whole data is read

[ Upstream commit f4919ff59c2828064b4156e3c3600a169909bcf4 ]

Currently, when userspace reads a datagram with a buffer that is
smaller than this datagram, the data will be truncated and only
part of it can be received by users. It doesn't seem right that
users don't know the datagram size and have to use a huge buffer
to read it to avoid the truncation.

This patch to fix it by keeping the skb in rcv queue until the
whole data is read by users. Only the last msg of the datagram
will be marked with MSG_EOR, just as TCP/SCTP does.

Note that this will work as above only when MSG_EOR is set in the
flags parameter of recvmsg(), so that it won't break any old user
applications.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/socket.c