Bug 2099822 - [4.10z] exporting a pointer for the loop variable
Summary: [4.10z] exporting a pointer for the loop variable
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 4.10
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.10.z
Assignee: Tim Rozet
QA Contact: Anurag saxena
URL:
Whiteboard:
: 2100092 (view as bug list)
Depends On: 2099821
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-21 18:50 UTC by Tim Rozet
Modified: 2022-07-07 11:40 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2099821
Environment:
Last Closed: 2022-07-07 11:40:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift ovn-kubernetes pull 1153 0 None open Bug 2099822: Fix pointer loop var 2022-06-22 13:26:37 UTC
Red Hat Product Errata RHBA-2022:5428 0 None None None 2022-07-07 11:40:39 UTC

Description Tim Rozet 2022-06-21 18:50:06 UTC
+++ This bug was initially created as a clone of Bug #2099821 +++

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.

--- Additional comment from Tim Rozet on 2022-06-21 18:49:17 UTC ---

Since this is not present in 4.11z, moving bug state.

Comment 1 Patryk Diak 2022-06-22 13:20:50 UTC
*** Bug 2100092 has been marked as a duplicate of this bug. ***

Comment 6 errata-xmlrpc 2022-07-07 11:40:21 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 (OpenShift Container Platform 4.10.21 bug fix 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/RHBA-2022:5428


Note You need to log in before you can comment on or make changes to this bug.