From ed0a43ab99ae3ca8bbf0c12bcd0487a6715b6aa6 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 13 Dec 2011 14:42:11 -0800 Subject: [PATCH 1/1] 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 bca9b8d02..b42c66e5f 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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) { -- 2.43.0