netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make sure sockets implement splice_read
@ 2008-02-14 16:53 Rémi Denis-Courmont
  2008-02-15 10:36 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Rémi Denis-Courmont @ 2008-02-14 16:53 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Fixes a segmentation fault when trying to splice from a non-TCP socket.

Signed-off-by: Rémi Denis-Courmont <rdenis@simphalempin.com>
---
 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);
 }
 
-- 
1.5.4.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-15 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14 16:53 [PATCH] Make sure sockets implement splice_read Rémi Denis-Courmont
2008-02-15 10:36 ` David Miller
2008-02-15 16:30   ` Andi Kleen
2008-02-15 16:40     ` Rémi Denis-Courmont
2008-02-15 16:46       ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).