Subject: [PATCH 30/39] sctp: fix the data size calculation in sctp_data_size

From: Xin Long <[email-masked]>
Date: Wed, 17 Oct 2018 21:11:27 +0800

[ Upstream commit 5660b9d9d6a29c2c3cc12f62ae44bfb56b0a15a9 ]

sctp data size should be calculated by subtracting data chunk header's
length from chunk_hdr->length, not just data header.

Fixes: 668c9beb9020 ("sctp: implement assign_number for sctp_stream_interleave")
Signed-off-by: Xin Long <[email-masked]>
Acked-by: Marcelo Ricardo Leitner <[email-masked]>
Signed-off-by: David S. Miller <[email-masked]>
---
 include/net/sctp/sm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 5ef1bad81ef5..9e3d32746430 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -347,7 +347,7 @@ static inline __u16 sctp_data_size(struct sctp_chunk *chunk)
 	__u16 size;
 
 	size = ntohs(chunk->chunk_hdr->length);
-	size -= sctp_datahdr_len(&chunk->asoc->stream);
+	size -= sctp_datachk_len(&chunk->asoc->stream);
 
 	return size;
 }
-- 
2.19.1