summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRémi Denis-Courmont <rdenis@simphalempin.com>2008-02-15 11:35:45 +0100
committerDavid S. Miller <davem@davemloft.net>2008-02-15 11:35:45 +0100
commit997b37da1515c1620692521786a74af271664eb7 (patch)
treeffd071fe5efb432228f5c915d1fd3c91e2439088 /net
parentnetconsole: avoid null pointer dereference at show_local_mac() (diff)
downloadlinux-997b37da1515c1620692521786a74af271664eb7.tar.xz
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')
-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);
}