From bca0b3b4e2ec98193258e67720bc29c81be6cd6f Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Fri, 19 Jul 2013 12:59:51 -0700 Subject: [PATCH] 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 Signed-off-by: Ethan Jackson Acked-by: Ben Pfaff --- lib/bond.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } -- 2.47.0