Skip to content

Commit 2e3219b

Browse files
Wei Yongjundavem330
authored andcommitted
sctp: fix append error cause to ERROR chunk correctly
commit 5fa782c 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>
1 parent f8bd909 commit 2e3219b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/sctp/sm_make_chunk.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code,
141141
len = sizeof(sctp_errhdr_t) + paylen;
142142
err.length = htons(len);
143143

144-
if (skb_tailroom(chunk->skb) > len)
144+
if (skb_tailroom(chunk->skb) < len)
145145
return -ENOSPC;
146146
chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk,
147147
sizeof(sctp_errhdr_t),
@@ -1415,7 +1415,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
14151415
void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk,
14161416
int len, const void *data)
14171417
{
1418-
if (skb_tailroom(chunk->skb) > len)
1418+
if (skb_tailroom(chunk->skb) >= len)
14191419
return sctp_addto_chunk(chunk, len, data);
14201420
else
14211421
return NULL;

0 commit comments

Comments
 (0)