]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sctp/ulpevent.c
sctp: Rework the tsn map to use generic bitmap.
[linux-2.6-omap-h63xx.git] / net / sctp / ulpevent.c
index ce6cda6b6994daaf5e1a64c09fdb31c126e07b5b..5f186ca550d798e7fa4e6bad1262d16aca82dae4 100644 (file)
@@ -710,6 +710,13 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
        if (!skb)
                goto fail;
 
+       /* Now that all memory allocations for this chunk succeeded, we
+        * can mark it as received so the tsn_map is updated correctly.
+        */
+       if (sctp_tsnmap_mark(&asoc->peer.tsn_map,
+                            ntohl(chunk->subh.data_hdr->tsn)))
+               goto fail_mark;
+
        /* First calculate the padding, so we don't inadvertently
         * pass up the wrong length to the user.
         *
@@ -750,8 +757,12 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
        event->msg_flags |= chunk->chunk_hdr->flags;
        event->iif = sctp_chunk_iif(chunk);
 
-fail:
        return event;
+
+fail_mark:
+       kfree_skb(skb);
+fail:
+       return NULL;
 }
 
 /* Create a partial delivery related event.