patch-2.1.112 linux/net/x25/x25_in.c

Next file: linux/net/x25/x25_link.c
Previous file: linux/net/x25/x25_facilities.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.111/linux/net/x25/x25_in.c linux/net/x25/x25_in.c
@@ -49,17 +49,20 @@
 	if (more) {
 		sk->protinfo.x25->fraglen += skb->len;
 		skb_queue_tail(&sk->protinfo.x25->fragment_queue, skb);
+		skb_set_owner_r(skb, sk);
 		return 0;
 	}
 
 	if (!more && sk->protinfo.x25->fraglen > 0) {	/* End of fragment */
-		sk->protinfo.x25->fraglen += skb->len;
-		skb_queue_tail(&sk->protinfo.x25->fragment_queue, skb);
+		int len = sk->protinfo.x25->fraglen + skb->len;
 
-		if ((skbn = alloc_skb(sk->protinfo.x25->fraglen, GFP_ATOMIC)) == NULL)
+		if ((skbn = alloc_skb(len, GFP_ATOMIC)) == NULL){
+			kfree_skb(skb);
 			return 1;
+		}
+
+		skb_queue_tail(&sk->protinfo.x25->fragment_queue, skb);
 
-		skb_set_owner_r(skbn, sk);
 		skbn->h.raw = skbn->data;
 
 		skbo = skb_dequeue(&sk->protinfo.x25->fragment_queue);
@@ -75,7 +78,12 @@
 		sk->protinfo.x25->fraglen = 0;		
 	}
 
-	return sock_queue_rcv_skb(sk, skbn);
+	skb_set_owner_r(skbn, sk);
+	skb_queue_tail(&sk->receive_queue, skbn);
+	if (!sk->dead)
+		sk->data_ready(sk,skbn->len);
+
+	return 0;
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov