summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <rdenis@simphalempin.com>2008-02-15 02:35:45 -0800
committerDavid S. Miller <davem@davemloft.net>2008-02-15 02:35:45 -0800
commit997b37da1515c1620692521786a74af271664eb7 (patch)
treeffd071fe5efb432228f5c915d1fd3c91e2439088 /net/socket.c
parent69c3683ca7fe066ecba9e8a0424c5abd258a5d58 (diff)
downloadlinux-997b37da1515c1620692521786a74af271664eb7.tar.gz
linux-997b37da1515c1620692521786a74af271664eb7.tar.bz2
linux-997b37da1515c1620692521786a74af271664eb7.zip
[NET]: Make sure sockets implement splice_read
Fixes a segmentation fault when trying to splice from a non-TCP socket. Signed-off-by: Rémi Denis-Courmont <rdenis@simphalempin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 7651de008502..b6d35cd72a50 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -701,6 +701,9 @@ 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 sock->ops->splice_read(sock, ppos, pipe, len, flags);
}