From: Ben Pfaff Date: Tue, 13 Dec 2011 22:42:11 +0000 (-0800) Subject: ofproto-dpif: Avoid segfault for ports with bundles in add_mirror_actions(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=521472bcd66ba7b2553183615a70e9dbac356d4f;p=openvswitch ofproto-dpif: Avoid segfault for ports with bundles in add_mirror_actions(). 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 Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 1b654fd9..e68bec35 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4993,7 +4993,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) {