Skip to content

Commit

Permalink
Fixes unsafe get on port cache
Browse files Browse the repository at this point in the history
Get on port cache was returning the actual object in the cache instead
of a copy.

Signed-off-by: Tim Rozet <trozet@redhat.com>
  • Loading branch information
trozet committed Mar 24, 2022
1 parent 999f344 commit b382400
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go-controller/pkg/ovn/port_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func (c *portCache) get(logicalPort string) (*lpInfo, error) {
c.RLock()
defer c.RUnlock()
if info, ok := c.cache[logicalPort]; ok {
return info, nil
x := *info
return &x, nil
}
return nil, fmt.Errorf("logical port %s not found in cache", logicalPort)
}
Expand Down

0 comments on commit b382400

Please sign in to comment.