From: Justin Pettit Date: Thu, 17 Nov 2011 22:08:09 +0000 (-0800) Subject: ofproto-dpif: Fix segfault in mirror_update_dups(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=edb0540bbcc624675b8745f52e085ef15d0fa023;p=openvswitch ofproto-dpif: Fix segfault in mirror_update_dups(). Fixes crash introduced in 9ba15e (ofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n).) The code always dereferenced the members of the "mirrors" array in ofproto even if they were null. --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 86723e14..3e92493c 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1682,7 +1682,7 @@ mirror_update_dups(struct ofproto_dpif *ofproto) for (j = i + 1; j < MAX_MIRRORS; j++) { struct ofmirror *m2 = ofproto->mirrors[j]; - if (m1->out == m2->out && m1->out_vlan == m2->out_vlan) { + if (m2 && m1->out == m2->out && m1->out_vlan == m2->out_vlan) { m1->dup_mirrors |= MIRROR_MASK_C(1) << j; m2->dup_mirrors |= m1->dup_mirrors; }