OSDN Git Service

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)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Jul 2021 00:28:09 +0000 (17:28 -0700)
commitf4919ff59c2828064b4156e3c3600a169909bcf4
tree86c156b71762203045a3eef3fa3339b4d27ef6a6
parent5242b0c6b5f8032bcd61e9c54695a8b92524f647
tipc: keep the skb in rcv queue until the whole data is read

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>
net/tipc/socket.c