* [PATCH] [SCTP] Fix a type cast bug
@ 2008-05-16 8:49 Gui Jianfeng
2008-05-16 12:48 ` Vlad Yasevich
0 siblings, 1 reply; 2+ messages in thread
From: Gui Jianfeng @ 2008-05-16 8:49 UTC (permalink / raw)
To: vladislav, linux-sctp; +Cc: David Miller, netdev
Vlad,
event_arg can never be the type of "struct sctp_chunk *"
if the event_type is SCTP_EVENT_T_OTHER. This fix
prevents from potential kernel crash by some misuse.
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
net/sctp/sm_sideeffect.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index a4763fd..1b4bae9 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1072,7 +1072,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
struct sctp_sackhdr sackh;
int local_cork = 0;
- if (SCTP_EVENT_T_TIMEOUT != event_type)
+ if (SCTP_EVENT_T_TIMEOUT != event_type &&
+ SCTP_EVENT_T_OTHER != event_type)
chunk = (struct sctp_chunk *) event_arg;
/* Note: This whole file is a huge candidate for rework.
--
1.5.3
--
Regards
Gui Jianfeng
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [SCTP] Fix a type cast bug
2008-05-16 8:49 [PATCH] [SCTP] Fix a type cast bug Gui Jianfeng
@ 2008-05-16 12:48 ` Vlad Yasevich
0 siblings, 0 replies; 2+ messages in thread
From: Vlad Yasevich @ 2008-05-16 12:48 UTC (permalink / raw)
To: Gui Jianfeng; +Cc: linux-sctp, David Miller, netdev
Gui
Gui Jianfeng wrote:
> Vlad,
>
> event_arg can never be the type of "struct sctp_chunk *"
> if the event_type is SCTP_EVENT_T_OTHER. This fix
> prevents from potential kernel crash by some misuse.
>
> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
> ---
> net/sctp/sm_sideeffect.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
> index a4763fd..1b4bae9 100644
> --- a/net/sctp/sm_sideeffect.c
> +++ b/net/sctp/sm_sideeffect.c
> @@ -1072,7 +1072,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
> struct sctp_sackhdr sackh;
> int local_cork = 0;
>
> - if (SCTP_EVENT_T_TIMEOUT != event_type)
> + if (SCTP_EVENT_T_TIMEOUT != event_type &&
> + SCTP_EVENT_T_OTHER != event_type)
> chunk = (struct sctp_chunk *) event_arg;
>
> /* Note: This whole file is a huge candidate for rework.
This doesn't really fix the bug since the event_arg can be something else during
primitive events and you would still have a typecast issue.
This code is rather ugly, but if we are going to clean it up, we need to do right
and not band-aid to death.
As it is, NACK on this patch, since it doesn't solve the problem.
-vlad
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-16 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-16 8:49 [PATCH] [SCTP] Fix a type cast bug Gui Jianfeng
2008-05-16 12:48 ` Vlad Yasevich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).