diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2008-07-08 05:28:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-08 05:28:39 -0400 |
commit | 3888e9efc9bf05e60504d2a420be7a527ff43678 (patch) | |
tree | 5c4b889c057eac0951ed8bf248379ce2dcc33f90 /net/sctp/ulpevent.c | |
parent | 6e43829bb69bf1d584a592075f1357590eb49b1a (diff) |
sctp: Mark the tsn as received after all allocations finish
If we don't have the buffer space or memory allocations fail,
the data chunk is dropped, but TSN is still reported as received.
This introduced a data loss that can't be recovered. We should
only mark TSNs are received after memory allocations finish.
The one exception is the invalid stream identifier, but that's
due to user error and is reported back to the user.
This was noticed by Michael Tuexen.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/ulpevent.c')
-rw-r--r-- | net/sctp/ulpevent.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index ce6cda6b6994..a1f654aea268 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -710,6 +710,11 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, | |||
710 | if (!skb) | 710 | if (!skb) |
711 | goto fail; | 711 | goto fail; |
712 | 712 | ||
713 | /* Now that all memory allocations for this chunk succeeded, we | ||
714 | * can mark it as received so the tsn_map is updated correctly. | ||
715 | */ | ||
716 | sctp_tsnmap_mark(&asoc->peer.tsn_map, ntohl(chunk->subh.data_hdr->tsn)); | ||
717 | |||
713 | /* First calculate the padding, so we don't inadvertently | 718 | /* First calculate the padding, so we don't inadvertently |
714 | * pass up the wrong length to the user. | 719 | * pass up the wrong length to the user. |
715 | * | 720 | * |