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-Tag: v1.4.0~34 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ed0a43ab99ae3ca8bbf0c12bcd0487a6715b6aa6;hp=4cf7aabac84e724929f9ab4031f0ea07a2cd0f1c;p=sliver-openvswitch.git 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 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) {