OSDN Git Service

mptcp: fix races between shutdown and recvmsg
authorPaolo Abeni <pabeni@redhat.com>
Wed, 10 Jun 2020 08:47:41 +0000 (10:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Jun 2020 20:34:14 +0000 (13:34 -0700)
commit5969856ae8ce29c9d523a1a6145cbd9e87f7046c
treeb90d784ed77ae10ea21a668c4a6eb0def76e8300
parent50cb8769f2c1c657a470bda192b79ff679d0ecfc
mptcp: fix races between shutdown and recvmsg

The msk sk_shutdown flag is set by a workqueue, possibly
introducing some delay in user-space notification. If the last
subflow carries some data with the fin packet, the user space
can wake-up before RCV_SHUTDOWN is set. If it executes unblocking
recvmsg(), it may return with an error instead of eof.

Address the issue explicitly checking for eof in recvmsg(), when
no data is found.

Fixes: 59832e246515 ("mptcp: subflow: check parent mptcp socket on subflow state change")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c