netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] yet another IPX nonlinear receive fix
@ 2006-08-08 23:18 Stephen Hemminger
  2006-08-08 23:49 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2006-08-08 23:18 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, David S. Miller; +Cc: netdev

Need to check some more cases in IPX receive.
If the skb is purely fragments, the IPX header needs to
be extracted. The function pskb_may_pull() may in theory invalidate
all the pointers in the skb, so references to ipx header must be
refreshed.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

---

 net/ipx/af_ipx.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

675a6798f7a587cae7acf1ad795366ee201e1a41
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index c13e86b..4019642 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1642,14 +1642,17 @@ static int ipx_rcv(struct sk_buff *skb, 
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
 		goto out;
 
-	ipx		= ipx_hdr(skb);
-	ipx_pktsize	= ntohs(ipx->ipx_pktsize);
+	if (!pskb_may_pull(skb, sizeof(struct ipxhdr)))
+		goto drop;
+
+	ipx_pktsize = ntohs(ipxhdr(skb)->ipx_pktsize);
 	
 	/* Too small or invalid header? */
 	if (ipx_pktsize < sizeof(struct ipxhdr) ||
 	    !pskb_may_pull(skb, ipx_pktsize))
 		goto drop;
                         
+	ipx = ipx_hdr(skb);
 	if (ipx->ipx_checksum != IPX_NO_CHECKSUM &&
 	   ipx->ipx_checksum != ipx_cksum(ipx, ipx_pktsize))
 		goto drop;
-- 
1.2.4


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

* Re: [PATCH] yet another IPX nonlinear receive fix
  2006-08-08 23:18 [PATCH] yet another IPX nonlinear receive fix Stephen Hemminger
@ 2006-08-08 23:49 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2006-08-08 23:49 UTC (permalink / raw)
  To: shemminger; +Cc: acme, netdev

From: Stephen Hemminger <shemminger@osdl.org>
Date: Tue, 8 Aug 2006 16:18:24 -0700

> Need to check some more cases in IPX receive.
> If the skb is purely fragments, the IPX header needs to
> be extracted. The function pskb_may_pull() may in theory invalidate
> all the pointers in the skb, so references to ipx header must be
> refreshed.
> 
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

Applied, thanks Stephen.

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

end of thread, other threads:[~2006-08-08 23:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-08 23:18 [PATCH] yet another IPX nonlinear receive fix Stephen Hemminger
2006-08-08 23:49 ` David Miller

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