patch-2.4.6 linux/net/ax25/ax25_in.c

Next file: linux/net/ax25/ax25_ip.c
Previous file: linux/net/atm/signaling.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/net/ax25/ax25_in.c linux/net/ax25/ax25_in.c
@@ -83,9 +83,11 @@
 
 				/* Last fragment received ? */
 				if (ax25->fragno == 0) {
-					if ((skbn = alloc_skb(AX25_MAX_HEADER_LEN + ax25->fraglen, GFP_ATOMIC)) == NULL) {
-						while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL)
-							kfree_skb(skbo);
+					skbn = alloc_skb(AX25_MAX_HEADER_LEN +
+							 ax25->fraglen,
+							 GFP_ATOMIC);
+					if (!skbn) {
+						skb_queue_purge(&ax25->frag_queue);
 						return 1;
 					}
 
@@ -113,8 +115,7 @@
 	} else {
 		/* First fragment received */
 		if (*skb->data & AX25_SEG_FIRST) {
-			while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL)
-				kfree_skb(skbo);
+			skb_queue_purge(&ax25->frag_queue);
 			ax25->fragno = *skb->data & AX25_SEG_REM;
 			skb_pull(skb, 1);		/* skip fragno */
 			ax25->fraglen = skb->len;
@@ -416,7 +417,8 @@
 	/*
 	 *	Sort out any digipeated paths.
 	 */
-	if (dp.ndigi != 0 && ax25->digipeat == NULL && (ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
+	if (dp.ndigi && !ax25->digipeat &&
+	    (ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
 		kfree_skb(skb);
 		ax25_destroy_socket(ax25);
 		return 0;
@@ -468,7 +470,8 @@
 /*
  *	Receive an AX.25 frame via a SLIP interface.
  */
-int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype)
+int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
+		  struct packet_type *ptype)
 {
 	skb->sk = NULL;		/* Initially we don't know who it's for */
 	skb->destructor = NULL;	/* Who initializes this, dammit?! */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)