mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
sctp: fix append error cause to ERROR chunk correctly
commit2e3219b5c8
upstream. commit5fa782c2f5
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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
6090875e7a
commit
f7cbc53758
@ -140,7 +140,7 @@ int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code,
|
||||
len = sizeof(sctp_errhdr_t) + paylen;
|
||||
err.length = htons(len);
|
||||
|
||||
if (skb_tailroom(chunk->skb) > len)
|
||||
if (skb_tailroom(chunk->skb) < len)
|
||||
return -ENOSPC;
|
||||
chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk,
|
||||
sizeof(sctp_errhdr_t),
|
||||
@ -1420,7 +1420,7 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
|
||||
void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk,
|
||||
int len, const void *data)
|
||||
{
|
||||
if (skb_tailroom(chunk->skb) > len)
|
||||
if (skb_tailroom(chunk->skb) >= len)
|
||||
return sctp_addto_chunk(chunk, len, data);
|
||||
else
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user