Bug 2099821

Summary: exporting a pointer for the loop variable
Product: OpenShift Container Platform Reporter: Tim Rozet <trozet>
Component: NetworkingAssignee: Tim Rozet <trozet>
Networking sub component: ovn-kubernetes QA Contact: Anurag saxena <anusaxen>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high    
Version: 4.10   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2099822 (view as bug list) Environment:
Last Closed: 2022-08-10 11:18:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2099822    

Description Tim Rozet 2022-06-21 18:48:27 UTC
Description of problem:
This problem was fixed in 4.11 during the dev cycle but still appears to be an issue in 4.10. There are many places in the code where this type of for loop is done:

	for i, sw := range switches {
		sw.ACLs = aclUUIDs
		swName := switches[i].Name
		opModels = append(opModels, OperationModel{
			Model:          &sw,
			ModelPredicate: func(ls *nbdb.LogicalSwitch) bool { return ls.Name == swName },
			OnModelMutations: []interface{}{
				&sw.ACLs,
			},
			ErrNotFound: true,
			BulkOp:      true,
		})
	}

Where the address of the loop variable is used to add to a slice. This will cause the slice to only ever hold the final object in the loop. One of the consequences of this kind of bug is that ACLs, or other OVN configuration may be missing since only the final object int he loop will have configuration applied.

Comment 1 Tim Rozet 2022-06-21 18:49:17 UTC
Since this is not present in 4.11z, moving bug state.

Comment 5 errata-xmlrpc 2022-08-10 11:18:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069