if (pskb_trim(skb, end-offset)) 
if (pskb_trim_rcsum(skb, end-offset)) 
static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb){	struct sk_buff *prev, *next;	int flags, offset;	int ihl, end;	if (qp->last_in & COMPLETE)		goto err; 	offset = ntohs(skb->nh.iph->frag_off);	flags = offset & ~IP_OFFSET;	offset &= IP_OFFSET;	offset <<= 3;		/* offset is in 8-byte chunks */ 	ihl = skb->nh.iph->ihl * 4;	/* Determine the position of this fragment. */ 	end = offset + skb->len - ihl;	/* Is this the final fragment? */	if ((flags & IP_MF) == 0) {		/* If we already have some bits beyond end		 * or have different end, the segment is corrrupted.		 */		if (end < qp->len ||		    ((qp->last_in & LAST_IN) && end != qp->len))			goto err;		qp->last_in |= LAST_IN;		qp->len = end;	} else {		if (end&7) {			end &= ~7;			if (skb->ip_summed != CHECKSUM_UNNECESSARY)				skb->ip_summed = CHECKSUM_NONE;		}		if (end > qp->len) {			/* Some bits beyond end -> corruption. */			if (qp->last_in & LAST_IN)				goto err;			qp->len = end;		}	}	if (end == offset)		goto err;	if (pskb_pull(skb, ihl) == NULL)		goto err;	if (pskb_trim(skb, end-offset))		goto err;	/* Find out which fragments are in front and at the back of us	 * in the chain of fragments so far.  We must know where to put	 * this fragment, right?	 */	prev = NULL;	for(next = qp->fragments; next != NULL; next = next->next) {		if (FRAG_CB(next)->offset >= offset)			break;	/* bingo! */		prev = next;	}	/* We found where to put this one.  Check for overlap with	 * preceding fragment, and, if needed, align things so that	 * any overlaps are eliminated.	 */	if (prev) {		int i = (FRAG_CB(prev)->offset + prev->len) - offset;		if (i > 0) {			offset += i;			if (end <= offset)				goto err;			if (!pskb_pull(skb, i))				goto err;			if (skb->ip_summed != CHECKSUM_UNNECESSARY)				skb->ip_summed = CHECKSUM_NONE;		}	}	while (next && FRAG_CB(next)->offset < end) {		int i = end - FRAG_CB(next)->offset; /* overlap is 'i' bytes */		if (i < next->len) {			/* Eat head of the next overlapped fragment			 * and leave the loop. The next ones cannot overlap.			 */			if (!pskb_pull(next, i))				goto err;			FRAG_CB(next)->offset += i;			qp->meat -= i;			if (next->ip_summed != CHECKSUM_UNNECESSARY)				next->ip_summed = CHECKSUM_NONE;			break;		} else {			struct sk_buff *free_it = next;			/* Old fragmnet is completely overridden with			 * new one drop it.			 */			next = next->next;			if (prev)				prev->next = next;			else				qp->fragments = next;			qp->meat -= free_it->len;			frag_kfree_skb(free_it, NULL);		}	}	FRAG_CB(skb)->offset = offset;	/* Insert this fragment in the chain of fragments. */	skb->next = next;	if (prev)		prev->next = skb;	else		qp->fragments = skb; 	if (skb->dev) 		qp->iif = skb->dev->ifindex;	skb->dev = NULL;	skb_get_timestamp(skb, &qp->stamp);	qp->meat += skb->len;	atomic_add(skb->truesize, &ip_frag_mem);	if (offset == 0)		qp->last_in |= FIRST_IN;	write_lock(&ipfrag_lock);	list_move_tail(&qp->lru_list, &ipq_lru_list);	write_unlock(&ipfrag_lock);	return;err:	kfree_skb(skb);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/48bc41a49c4f3aa760dff84e7f71437f5ed520fe/ip_fragment.c/buggy/net/ipv4/ip_fragment.c