From 521472bcd66ba7b2553183615a70e9dbac356d4f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 13 Dec 2011 14:42:11 -0800 Subject: [PATCH] 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 --- ofproto/ofproto-dpif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) { -- 2.30.2