From d47761db97d35cd7fc194e4472b3a20a46f64dc7 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Fri, 9 Aug 2019 08:40:20 +0100 Subject: um: Error handling fixes in vector drivers With the addition of bess support which uses connection oriented SEQPACKET sockets the vector routines can now encounter a "remote end closed the connection" scenario. This adds handling code to detect it in the TX path and the legacy RX path. There is no way to detect it in the vector RX path because that can legitimately return 0 even if the remote end has not closed the connection. As a result the detection is delayed until the first TX event after the close. Signed-off-by: Anton Ivanov Signed-off-by: Richard Weinberger --- arch/um/drivers/vector_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/um/drivers/vector_user.c') diff --git a/arch/um/drivers/vector_user.c b/arch/um/drivers/vector_user.c index 4e068beb9f66..f92e05ad145f 100644 --- a/arch/um/drivers/vector_user.c +++ b/arch/um/drivers/vector_user.c @@ -618,7 +618,7 @@ int uml_vector_writev(int fd, void *hdr, int iovcount) int n; CATCH_EINTR(n = writev(fd, (struct iovec *) hdr, iovcount)); - if ((n < 0) && (errno == EAGAIN)) + if ((n < 0) && ((errno == EAGAIN) || (errno == ENOBUFS))) return 0; if (n >= 0) return n; @@ -635,7 +635,7 @@ int uml_vector_sendmmsg( int n; CATCH_EINTR(n = sendmmsg(fd, (struct mmsghdr *) msgvec, vlen, flags)); - if ((n < 0) && (errno == EAGAIN)) + if ((n < 0) && ((errno == EAGAIN) || (errno == ENOBUFS))) return 0; if (n >= 0) return n; -- cgit v1.2.3