aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_make_chunk.c
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2009-11-23 15:53:56 -0500
committerVlad Yasevich <vladislav.yasevich@hp.com>2009-11-23 15:53:56 -0500
commit6383cfb3ed3c5c0bea06da0099c219ef4237ecf5 (patch)
treee3bfb43500b664c5a572d0a9456d7e7ec4f7aeab /net/sctp/sm_make_chunk.c
parentb93d6471748de2ce02cc24774b774deb306a57a8 (diff)
sctp: Fix malformed "Invalid Stream Identifier" error
The "Invalid Stream Identifier" error has a 16 bit reserved field at the end, thus making the parameter length be 8 bytes. We've never supplied that reserved field making wireshark tag the packet as malformed. Reported-by: Chris Dischino <cdischino@sonusnet.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/sm_make_chunk.c')
-rw-r--r--net/sctp/sm_make_chunk.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 9d881a61ac02..9e732916b671 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -987,7 +987,10 @@ static void *sctp_addto_param(struct sctp_chunk *chunk, int len,
987 987
988 target = skb_put(chunk->skb, len); 988 target = skb_put(chunk->skb, len);
989 989
990 memcpy(target, data, len); 990 if (data)
991 memcpy(target, data, len);
992 else
993 memset(target, 0, len);
991 994
992 /* Adjust the chunk length field. */ 995 /* Adjust the chunk length field. */
993 chunk->chunk_hdr->length = htons(chunklen + len); 996 chunk->chunk_hdr->length = htons(chunklen + len);
@@ -1129,16 +1132,18 @@ nodata:
1129struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc, 1132struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc,
1130 const struct sctp_chunk *chunk, 1133 const struct sctp_chunk *chunk,
1131 __be16 cause_code, const void *payload, 1134 __be16 cause_code, const void *payload,
1132 size_t paylen) 1135 size_t paylen, size_t reserve_tail)
1133{ 1136{
1134 struct sctp_chunk *retval; 1137 struct sctp_chunk *retval;
1135 1138
1136 retval = sctp_make_op_error_space(asoc, chunk, paylen); 1139 retval = sctp_make_op_error_space(asoc, chunk, paylen + reserve_tail);
1137 if (!retval) 1140 if (!retval)
1138 goto nodata; 1141 goto nodata;
1139 1142
1140 sctp_init_cause(retval, cause_code, paylen); 1143 sctp_init_cause(retval, cause_code, paylen + reserve_tail);
1141 sctp_addto_chunk(retval, paylen, payload); 1144 sctp_addto_chunk(retval, paylen, payload);
1145 if (reserve_tail)
1146 sctp_addto_param(retval, reserve_tail, NULL);
1142 1147
1143nodata: 1148nodata:
1144 return retval; 1149 return retval;