netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [SCTP]: Always linearise packet on input
@ 2006-10-30  7:11 Herbert Xu
  2006-10-30  7:46 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Herbert Xu @ 2006-10-30  7:11 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: Sridhar Samudrala

Hi Dave:

[SCTP]: Always linearise packet on input

I was looking at a RHEL5 bug report involving Xen and SCTP
(https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=212550).
It turns out that SCTP wasn't written to handle skb fragments at
all.  The absence of any calls to skb_may_pull is testament to
that.

It just so happens that Xen creates fragmented packets more often
than other scenarios (header & data split when going from domU to
dom0).  That's what caused this bug to show up.

Until someone has the time sits down and audits the entire net/sctp
directory, here is a conservative and safe solution that simply
linearises all packets on input.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Sridhar, could you please organise an audit of SCTP to make sure
that it deals with skb fragments (both pages and frag_list) in a
safe manner? Basically before you do an skb_pull or access skb->data
you must ensure that the data you want to access is in the head,
usually by doing skb_may_pull.  Of course, for large payloads it
helps if you can avoid pulling it into the head.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 64f6301..99c0501 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -135,6 +135,9 @@ int sctp_rcv(struct sk_buff *skb)
 
 	SCTP_INC_STATS_BH(SCTP_MIB_INSCTPPACKS);
 
+	if (skb_linearize(skb))
+		goto discard_it;
+
 	sh = (struct sctphdr *) skb->h.raw;
 
 	/* Pull up the IP and SCTP headers. */

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

end of thread, other threads:[~2006-10-31 18:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-30  7:11 [SCTP]: Always linearise packet on input Herbert Xu
2006-10-30  7:46 ` David Miller
2006-10-31  1:31   ` Sridhar Samudrala
2006-10-31  3:01     ` Herbert Xu
2006-10-31 14:36       ` Vlad Yasevich
2006-10-31 18:18         ` Sridhar Samudrala
2006-10-31 18:46           ` Vlad Yasevich

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).