[ovs-dev] [PATCH] bond: Fix segfault sending learning packets with LACP disabled.

Ben Pfaff blp at nicira.com
Thu Nov 29 17:50:36 UTC 2012


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 <kiran at vmware.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
I tested a similar patch last night, but I modified it a bit since
then, so I'll test this final patch again before I apply it.

 AUTHORS    |    1 +
 lib/bond.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index c699998..4f2dba4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -133,6 +133,7 @@ Jeongkeun Lee           jklee at hp.com
 Joan Cirer              joan at ev0.net
 John Galgay             john at galgay.net
 Kevin Mancuso           kevin.mancuso at rackspace.com
+Kiran Shanbhog          kiran at vmware.com
 Kirill Kabardin
 Koichi Yagishita        yagishita.koichi at jrc.co.jp
 Konstantin Khorenko     khorenko at openvz.org
diff --git a/lib/bond.c b/lib/bond.c
index 5805294..141c742 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;
 }
 
-- 
1.7.2.5




More information about the dev mailing list