bond: Support null argument to bond_ref().
authorEthan Jackson <ethan@nicira.com>
Fri, 19 Jul 2013 19:59:51 +0000 (12:59 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 19 Jul 2013 20:02:59 +0000 (13:02 -0700)
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>
lib/bond.c

index 183c37b..b3ae0c4 100644 (file)
@@ -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;
 }