Skip to contentSkip to conversation

socket: do a generic_file_splice_read when proto_ops has no splice_read

PATCH Applied [email protected] 2 participants 2 messages Nov 16, 2018 – Nov 18, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 socket: do a generic_file_splice_read when proto_ops has no splice_read

From: Slavomir Kaslev <[email protected]>

splice(2) fails with -EINVAL when called reading on a socket with no splice_read set in its proto_ops (such as vsock sockets). Switch this to fallbacks to a generic_file_splice_read instead.

---
 net/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/socket.c +1 -1
index 593826e11a53..334fcc617ef2 100644
@@ -853,7 +853,7 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
 	struct socket *sock = file->private_data;
 
 	if (unlikely(!sock->ops->splice_read))
-		return -EINVAL;
+		return generic_file_splice_read(file, ppos, pipe, len, flags);
 
 	return sock->ops->splice_read(sock, ppos, pipe, len, flags);
 }
Signature · 1 line
2.19.1
maintainer Applied
#1 lore raw

From: [email protected]
Date: Fri, 16 Nov 2018 11:27:53 +0200

Quoted 7 lines

From: Slavomir Kaslev <[email protected]>

splice(2) fails with -EINVAL when called reading on a socket with no splice_read set in its proto_ops (such as vsock sockets). Switch this to fallbacks to a generic_file_splice_read instead.

Applied.

I wonder why we left things this way for so long.