From mboxrd@z Thu Jan 1 00:00:00 1970 From: ISHIKAWA Mutsumi Subject: [PATCH] Fix divide zero crash when xmit with no enabled port Date: Sun, 22 Jul 2012 05:30:35 +0900 Message-ID: <20120721203035.71B4DFFC4A@master.hanzubon.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: netdev@vger.kernel.org To: jpirko@redhat.com Return-path: Received: from hanzubin.st.wakwak.ne.jp ([61.115.118.67]:46414 "EHLO master.hanzubon.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737Ab2GUUiZ (ORCPT ); Sat, 21 Jul 2012 16:38:25 -0400 Sender: netdev-owner@vger.kernel.org List-ID: 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