* [PATCH] Fix divide zero crash when xmit with no enabled port
@ 2012-07-21 20:30 ISHIKAWA Mutsumi
2012-07-22 13:59 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: ISHIKAWA Mutsumi @ 2012-07-21 20:30 UTC (permalink / raw)
To: jpirko; +Cc: netdev
hash calculation in lb_transmit() cause divide zero crash when
xmit on teaming loadbalance mode with no team member port is enabled
(this situation means team->en_port_count = 0). Add check
team->en_port_count is not 0.
---
drivers/net/team/team_mode_loadbalance.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 86e8183..7b878d5 100644
--- a/drivers/net/team/team_mode_loadbalance.c
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -38,6 +38,8 @@ static bool lb_transmit(struct team *team, struct sk_buff *skb)
if (unlikely(!fp))
goto drop;
hash = SK_RUN_FILTER(fp, skb);
+ if (team->en_port_count < 1)
+ goto drop;
port_index = hash % team->en_port_count;
port = team_get_port_by_index_rcu(team, port_index);
if (unlikely(!port))
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix divide zero crash when xmit with no enabled port
2012-07-21 20:30 [PATCH] Fix divide zero crash when xmit with no enabled port ISHIKAWA Mutsumi
@ 2012-07-22 13:59 ` Jiri Pirko
2012-07-23 0:49 ` ISHIKAWA Mutsumi
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2012-07-22 13:59 UTC (permalink / raw)
To: ISHIKAWA Mutsumi; +Cc: netdev
Sat, Jul 21, 2012 at 10:30:35PM CEST, ishikawa@hanzubon.jp wrote:
>
>hash calculation in lb_transmit() cause divide zero crash when
>xmit on teaming loadbalance mode with no team member port is enabled
>(this situation means team->en_port_count = 0). Add check
>team->en_port_count is not 0.
What kernel are you see the issue one?
I believe this is fixed in net-next already:
commit 122bb046bcfb8f3d2d94d9f7f6b74da187a740f2
Author: Jiri Pirko <jpirko@redhat.com>
Date: Tue Jun 26 06:52:45 2012 +0000
team: fix team_adjust_ops with regard to enabled ports
team_adjust_ops should check for enabled ports, not all ports.
This may lead to division by zero. This patch fixes this.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
>
>---
> drivers/net/team/team_mode_loadbalance.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
>index 86e8183..7b878d5 100644
>--- a/drivers/net/team/team_mode_loadbalance.c
>+++ b/drivers/net/team/team_mode_loadbalance.c
>@@ -38,6 +38,8 @@ static bool lb_transmit(struct team *team, struct sk_buff *skb)
> if (unlikely(!fp))
> goto drop;
> hash = SK_RUN_FILTER(fp, skb);
>+ if (team->en_port_count < 1)
>+ goto drop;
> port_index = hash % team->en_port_count;
> port = team_get_port_by_index_rcu(team, port_index);
> if (unlikely(!port))
>--
>1.7.10.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Fix divide zero crash when xmit with no enabled port
2012-07-22 13:59 ` Jiri Pirko
@ 2012-07-23 0:49 ` ISHIKAWA Mutsumi
0 siblings, 0 replies; 3+ messages in thread
From: ISHIKAWA Mutsumi @ 2012-07-23 0:49 UTC (permalink / raw)
To: jpirko; +Cc: netdev
>>>>> In <20120722135956.GA12129@minipsycho.orion>
>>>>> Jiri Pirko <jpirko@redhat.com> wrote:
>> Sat, Jul 21, 2012 at 10:30:35PM CEST, ishikawa@hanzubon.jp wrote:
>> >
>> >hash calculation in lb_transmit() cause divide zero crash when
>> >xmit on teaming loadbalance mode with no team member port is enabled
>> >(this situation means team->en_port_count = 0). Add check
>> >team->en_port_count is not 0.
>>
>> What kernel are you see the issue one?
>> I believe this is fixed in net-next already:
Oops, sorry. I've see it on linus's linux-2.6 git tree only.
--
ISHIKAWA Mutsumi
<ishikawa@debian.org>, <ishikawa@hanzubon.jp>, <ishikawa@osdn.jp>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-23 0:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-21 20:30 [PATCH] Fix divide zero crash when xmit with no enabled port ISHIKAWA Mutsumi
2012-07-22 13:59 ` Jiri Pirko
2012-07-23 0:49 ` ISHIKAWA Mutsumi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox