[NET]: Make sure sockets implement splice_read

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, February 15, 2008 - 6:01 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=997b37...
Commit:     997b37da1515c1620692521786a74af271664eb7
Parent:     69c3683ca7fe066ecba9e8a0424c5abd258a5d58
Author:     Rémi Denis-Courmont <rdenis@simphalempin.com>
AuthorDate: Fri Feb 15 02:35:45 2008 -0800
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Fri Feb 15 02:35:45 2008 -0800

    [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>
---
 net/socket.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 7651de0..b6d35cd 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);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[NET]: Make sure sockets implement splice_read, Linux Kernel Mailing List..., (Fri Feb 15, 6:01 pm)