Skip to content

Commit

Permalink
[NET]: Make sure sockets implement splice_read
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rémi Denis-Courmont authored and davem330 committed Feb 15, 2008
1 parent 69c3683 commit 997b37d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 997b37d

Please sign in to comment.