Bug 2099821 - exporting a pointer for the loop variable
Summary: 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.11.0
Assignee: Tim Rozet
QA Contact: Anurag saxena
URL:
Whiteboard:
Depends On:
Blocks: 2099822
TreeView+ depends on / blocked
 
Reported: 2022-06-21 18:48 UTC by Tim Rozet
Modified: 2022-08-10 11:19 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2099822 (view as bug list)
Environment:
Last Closed: 2022-08-10 11:18:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 11:19:18 UTC

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


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