Commit 997b37da authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by David S. Miller

[NET]: Make sure sockets implement splice_read

Fixes a segmentation fault when trying to splice from a non-TCP socket.
Signed-off-by: default avatarRémi Denis-Courmont <rdenis@simphalempin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69c3683c
...@@ -701,6 +701,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, ...@@ -701,6 +701,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
{ {
struct socket *sock = file->private_data; struct socket *sock = file->private_data;
if (unlikely(!sock->ops->splice_read))
return -EINVAL;
return sock->ops->splice_read(sock, ppos, pipe, len, flags); return sock->ops->splice_read(sock, ppos, pipe, len, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment