]> err.no Git - linux-2.6/commitdiff
SCTP: Fix sctp_addto_chunk() to add pad with correct length
authorWei Yongjun <yjwei@cn.fujitsu.com>
Mon, 6 Aug 2007 05:55:47 +0000 (13:55 +0800)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Thu, 30 Aug 2007 15:56:17 +0000 (11:56 -0400)
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>
net/sctp/sm_make_chunk.c

index 2b1129a7a94adfdad0687bf866351ffc7bba9892..93df833f34f4d556521c7e24611e872d1370e07e 100644 (file)
@@ -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);