Fix divide zero crash when xmit with no enabled port
Subsystems (3)
PATCH 1/1 Fix divide zero crash when xmit with no enabled port
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(+)
drivers/net/team/team_mode_loadbalance.c +2 -0
@@ -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))
Signature · 1 line
1.7.10.4
Quoted 5 lines · Sat, Jul 21, 2012 at 10:30:35PM CEST, [email protected] 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 meansteam->en_port_count= 0). Add checkteam->en_port_countis not 0.
What kernel are you see the issue one?
I believe this is fixed in net-next already:
commit 122bb046bcfb8f3d2d94d9f7f6b74da187a740f2
Author: Jiri Pirko <[email protected]> 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.
Quoted 21 lines
---
drivers/net/team/team_mode_loadbalance.c| 2 ++1 file changed, 2 insertions(+)drivers/net/team/team_mode_loadbalance.c +2
-0@@ -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))Signature · 1 line
1.7.10.4
Quoted 11 lines
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
In <[email protected]>
Jiri Pirko <[email protected]> wrote:Quoted 5 lines · Sat, Jul 21, 2012 at 10:30:35PM CEST, [email protected] 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 meansteam->en_port_count= 0). Add checkteam->en_port_countis 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.
Signature · 2 lines
ISHIKAWA Mutsumi <[email protected]>, <[email protected]>, <[email protected]>