From: Ben Pfaff Date: Thu, 29 Nov 2012 17:32:28 +0000 (-0800) Subject: bond: Fix segfault sending learning packets with LACP disabled. X-Git-Tag: v1.9.0~51 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=bbb17e3360103cc0dee9e1c4677ae696470254ff bond: Fix segfault sending learning packets with LACP disabled. It is essentially an invalid configuration to disable LACP but request TCP balancing: in this configuration, the bond drops all packets. But may_send_learning_packets() would still indicate that learning packets should be sent, so bond_compose_learning_packet() would try to choose an output slave for those packets, which would be NULL (because all packets are dropped), which would cause a segfault upon dereference. This commit fixes the problem by making may_send_learning_packets() no longer indicate that learning packets should be sent. I tested this issue by modifying bond_should_send_learning_packets() to always return true if may_send_learning_packets() returns true, and then introducing the invalid configuration described above. Without this comit, ovs-vswitchd segfaults quickly; with this commit, it does not. Bug #14090. Reported-by: Kiran Shanbhog Signed-off-by: Ben Pfaff --- diff --git a/AUTHORS b/AUTHORS index 46878657e..fa5efed4f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -131,6 +131,7 @@ Jeongkeun Lee jklee@hp.com Joan Cirer joan@ev0.net John Galgay john@galgay.net Kevin Mancuso kevin.mancuso@rackspace.com +Kiran Shanbhog kiran@vmware.com Kirill Kabardin Koichi Yagishita yagishita.koichi@jrc.co.jp Konstantin Khorenko khorenko@openvz.org diff --git a/lib/bond.c b/lib/bond.c index 25a0fa1a9..2c59f9d2a 100644 --- a/lib/bond.c +++ b/lib/bond.c @@ -494,7 +494,7 @@ static bool may_send_learning_packets(const struct bond *bond) { return bond->lacp_status == LACP_DISABLED - && bond->balance != BM_STABLE + && (bond->balance == BM_SLB || bond->balance == BM_AB) && bond->active_slave; }