aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2010-05-18 01:51:58 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-18 01:51:58 -0400
commit2e3219b5c8a2e44e0b83ae6e04f52f20a82ac0f2 (patch)
tree526cd94d906cc687f556631643fdfa43260918c5 /net
parentf8bd909183acffad68780b10c1cdf36161cfd5d1 (diff)
sctp: fix append error cause to ERROR chunk correctly
commit 5fa782c2f5ef6c2e4f04d3e228412c9b4a4c8809 sctp: Fix skb_over_panic resulting from multiple invalid \ parameter errors (CVE-2010-1173) (v4) cause 'error cause' never be add the the ERROR chunk due to some typo when check valid length in sctp_init_cause_fixed(). Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Reviewed-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sctp/sm_make_chunk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index d8261f3d7715..bd2a50b482ac 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -141,7 +141,7 @@ int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code,
141 len = sizeof(sctp_errhdr_t) + paylen; 141 len = sizeof(sctp_errhdr_t) + paylen;
142 err.length = htons(len); 142 err.length = htons(len);
143 143
144 if (skb_tailroom(chunk->skb) > len) 144 if (skb_tailroom(chunk->skb) < len)
145 return -ENOSPC; 145 return -ENOSPC;
146 chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk, 146 chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk,
147 sizeof(sctp_errhdr_t), 147 sizeof(sctp_errhdr_t),
@@ -1415,7 +1415,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
1415void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk, 1415void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk,
1416 int len, const void *data) 1416 int len, const void *data)
1417{ 1417{
1418 if (skb_tailroom(chunk->skb) > len) 1418 if (skb_tailroom(chunk->skb) >= len)
1419 return sctp_addto_chunk(chunk, len, data); 1419 return sctp_addto_chunk(chunk, len, data);
1420 else 1420 else
1421 return NULL; 1421 return NULL;