Skip to content

Commit

Permalink
SCTP: Fix sctp_addto_chunk() to add pad with correct length
Browse files Browse the repository at this point in the history
At function sctp_addto_chunk(), it do pad before add payload to chunk if
chunk length is not 4-byte alignment. But it do pad with a bad length.
This patch fixed this probleam.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
  • Loading branch information
Wei Yongjun authored and Vlad Yasevich committed Aug 30, 2007
1 parent ab3e5e7 commit 8d614ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sctp/sm_make_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
void *target;
void *padding;
int chunklen = ntohs(chunk->chunk_hdr->length);
int padlen = chunklen % 4;
int padlen = WORD_ROUND(chunklen) - chunklen;

padding = skb_put(chunk->skb, padlen);
target = skb_put(chunk->skb, len);
Expand Down

0 comments on commit 8d614ad

Please sign in to comment.