]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
espintcp: recv() should return 0 when the peer socket is closed
authorSabrina Dubroca <sd@queasysnail.net>
Thu, 16 Jul 2020 08:09:02 +0000 (10:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2020 07:58:39 +0000 (09:58 +0200)
commit589b5e620160cd5007136f863cedc20b24877f99
treec7d982e9b3934949bad0b3caaa99fd2ad8fc8b31
parentb273e491d24021a99a39bad1c3cec0c38221d8c5
espintcp: recv() should return 0 when the peer socket is closed

[ Upstream commit e229c877cde141a4c46cb603a341ce8c909e9a98 ]

man 2 recv says:

    RETURN VALUE

    When a stream socket peer has performed an orderly shutdown, the
    return value will be 0 (the traditional "end-of-file" return).

Currently, this works for blocking reads, but non-blocking reads will
return -EAGAIN. This patch overwrites that return value when the peer
won't send us any more data.

Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
Reported-by: Andrew Cagney <cagney@libreswan.org>
Tested-by: Andrew Cagney <cagney@libreswan.org>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xfrm/espintcp.c