Skip to contentSkip to conversation

sctp: fix append error cause to ERROR chunk correctly

PATCH In review Wei Yongjun 3 participants 4 messages May 13, 2010 – May 14, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
 net/sctp/sm_make_chunk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +2 -2
index 30c1767..70d6c10 100644
@@ -141,7 +141,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),
@@ -1421,7 +1421,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;
Signature · 1 line
1.6.5.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Wei Yongjun

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().

---
 net/sctp/sm_make_chunk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +1 -1
index 30c1767..70d6c10 100644
@@ -141,7 +141,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),

net/sctp/sm_make_chunk.c void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) · line 1427

Quoted 8 lines
net/sctp/sm_make_chunk.c +1 -1
@@ -1421,7 +1421,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;

Yup, thanks!

Quoted 5 lines
Signature · 1 line
1.6.5.2
#2 lore raw
In reply to Wei Yongjun
Quoted 36 lines · Neil Horman
Quoted 26 lines · Wei Yongjun

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().

---
 net/sctp/sm_make_chunk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +1 -1
index 30c1767..70d6c10 100644
@@ -141,7 +141,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),

net/sctp/sm_make_chunk.c void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) · line 1427

Quoted 8 lines
net/sctp/sm_make_chunk.c +1 -1
@@ -1421,7 +1421,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;

Yup, thanks!

Quoted 2 lines

Yikes.. Acked-by: Vlad Yasevich <[email protected]>

Please submit to netdev with all updated attributions.

#3 lore raw

PATCH 1/1 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().

---
 net/sctp/sm_make_chunk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_make_chunk.c +2 -2
index 30c1767..70d6c10 100644
@@ -141,7 +141,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),
@@ -1421,7 +1421,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;
Signature · 1 line
1.6.5.2