bond: Fix segfault sending learning packets with LACP disabled.
authorBen Pfaff <blp@nicira.com>
Thu, 29 Nov 2012 17:32:28 +0000 (09:32 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 29 Nov 2012 21:03:36 +0000 (13:03 -0800)
commitbbb17e3360103cc0dee9e1c4677ae696470254ff
tree4e6dbd1df35e6f4c4443240dca58a9a7c8756842
parentd4a05c76e317a01fa1341605150ffec77b444b0b
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 <kiran@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
AUTHORS
lib/bond.c