From: Ethan Jackson <ethan@nicira.com> Date: Fri, 19 Jul 2013 19:59:51 +0000 (-0700) Subject: bond: Support null argument to bond_ref(). X-Git-Tag: sliver-openvswitch-2.0.90-1~35^2~19 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=bca0b3b4e2ec98193258e67720bc29c81be6cd6f;p=sliver-openvswitch.git bond: Support null argument to bond_ref(). This is consistent with the other ref functions, and was causing segmentation faults in some test cases. Reported-by: Mukesh Hira <mhira@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com> --- diff --git a/lib/bond.c b/lib/bond.c index 183c37be1..b3ae0c4b1 100644 --- a/lib/bond.c +++ b/lib/bond.c @@ -195,8 +195,10 @@ bond_ref(const struct bond *bond_) { struct bond *bond = CONST_CAST(struct bond *, bond_); - ovs_assert(bond->ref_cnt > 0); - bond->ref_cnt++; + if (bond) { + ovs_assert(bond->ref_cnt > 0); + bond->ref_cnt++; + } return bond; }