* [PATCH] sctp: remove redundant chunk length check
@ 2010-10-21 10:14 Nicolas Kaiser
2010-10-21 12:06 ` Shan Wei
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Kaiser @ 2010-10-21 10:14 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: Sridhar Samudrala, linux-sctp, linux-kernel
Checking the chunk length at this point appears redundant, as
the rest of the packet gets discarded anyway.
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
net/sctp/sm_statefuns.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 4b4eb7c..9840615 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -3418,12 +3418,6 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep,
SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
- /* If the chunk length is invalid, we don't want to process
- * the reset of the packet.
- */
- if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t)))
- return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
-
/* We need to discard the rest of the packet to prevent
* potential bomming attacks from additional bundled chunks.
* This is documented in SCTP Threats ID.
--
1.7.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sctp: remove redundant chunk length check
2010-10-21 10:14 [PATCH] sctp: remove redundant chunk length check Nicolas Kaiser
@ 2010-10-21 12:06 ` Shan Wei
2010-10-21 13:08 ` Nicolas Kaiser
0 siblings, 1 reply; 3+ messages in thread
From: Shan Wei @ 2010-10-21 12:06 UTC (permalink / raw)
To: Nicolas Kaiser; +Cc: Vlad Yasevich, Sridhar Samudrala, linux-sctp, linux-kernel
Nicolas Kaiser wrote, at 10/21/2010 06:14 PM:
> Checking the chunk length at this point appears redundant, as
> the rest of the packet gets discarded anyway.
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Yes, indeed.
How did you find this? By reviewing the source code?
--
Best Regards
-----
Shan Wei
> ---
> net/sctp/sm_statefuns.c | 6 ------
> 1 files changed, 0 insertions(+), 6 deletions(-)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index 4b4eb7c..9840615 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -3418,12 +3418,6 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep,
>
> SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
>
> - /* If the chunk length is invalid, we don't want to process
> - * the reset of the packet.
> - */
> - if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t)))
> - return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
> -
> /* We need to discard the rest of the packet to prevent
> * potential bomming attacks from additional bundled chunks.
> * This is documented in SCTP Threats ID.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sctp: remove redundant chunk length check
2010-10-21 12:06 ` Shan Wei
@ 2010-10-21 13:08 ` Nicolas Kaiser
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Kaiser @ 2010-10-21 13:08 UTC (permalink / raw)
To: Shan Wei; +Cc: Vlad Yasevich, Sridhar Samudrala, linux-sctp, linux-kernel
* Shan Wei <shanwei@cn.fujitsu.com>:
> Nicolas Kaiser wrote, at 10/21/2010 06:14 PM:
> > Checking the chunk length at this point appears redundant, as
> > the rest of the packet gets discarded anyway.
> Yes, indeed.
>
> How did you find this? By reviewing the source code?
Actually I'm tinkering with Coccinelle patches.
Here's a simple semantic patch, that will give a lot of false
positives, and a lot of "if (a) return b; return b;":
// <smpl>
@@
expression a;
statement S;
@@
- if (a)
- {
- S
- }
S
// </smpl>
Best regards,
Nicolas Kaiser
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-21 13:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 10:14 [PATCH] sctp: remove redundant chunk length check Nicolas Kaiser
2010-10-21 12:06 ` Shan Wei
2010-10-21 13:08 ` Nicolas Kaiser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox