ofproto-dpif: Avoid segfault for ports with bundles in add_mirror_actions().
authorBen Pfaff <blp@nicira.com>
Tue, 13 Dec 2011 22:42:11 +0000 (14:42 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 13 Dec 2011 22:57:42 +0000 (14:57 -0800)
Not every port has an associated bundle, so we must not unconditionally
dereference ofport->bundle without first checking that it is nonnull.

(One example of a port without a bundle is a VLAN splinter port.)

Bug #8671.
Reported-by: Michael Mao <mmao@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c

index bca9b8d..b42c66e 100644 (file)
@@ -4932,7 +4932,9 @@ add_mirror_actions(struct action_xlate_ctx *ctx, const struct flow *orig_flow)
         }
 
         ofport = get_odp_port(ofproto, nl_attr_get_u32(a));
-        mirrors |= ofport ? ofport->bundle->dst_mirrors : 0;
+        if (ofport && ofport->bundle) {
+            mirrors |= ofport->bundle->dst_mirrors;
+        }
     }
 
     if (!mirrors) {