Bug 1467905 - Null pointer dereference when we get bad data
Null pointer dereference when we get bad data
Status: VERIFIED
Product: OpenShift Container Platform
Classification: Red Hat
Component: Service Broker (Show other bugs)
3.6.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.7.0
Assigned To: Dylan Murray
weiwei jiang
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-05 09:24 EDT by Jason Montleon
Modified: 2017-10-05 13:47 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Bad data being returned from the bootstrapped registry. Consequence: The broker fails to bootstrap and errors out due to a null pointer dereference. Fix: The broker now has logic to avoid dereferencing null pointers if the data is corrupted. Result: Broker skips image with bad data and continues.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jason Montleon 2017-07-05 09:24:54 EDT
Description of problem:
registry.acecss.redhat.com is returning bad results at the moment. It is sending back every image on the registry despite us doing a limited search. This is causing a null pointer dereference when we try to process a label that does not exist.

Version-Release number of selected component (if applicable):
ansible-service-broker 0.9.5

How reproducible:
Always

Steps to Reproduce:
1. Use catasb to install ansible-service-broker with an rhcc registry pointing at registry.access.redhat.com


Actual results:
During bootstrap you'll see:
2017/07/05 12:55:43 http: panic serving 172.18.0.1:37326: runtime error: invalid memory address or nil pointer dereference
goroutine 6418 [running]:
net/http.(*conn).serve.func1(0xc420098200)
	/usr/lib/golang/src/net/http/server.go:1491 +0x12a
panic(0x17cf1a0, 0xc420016080)
	/usr/lib/golang/src/runtime/panic.go:458 +0x243
github.com/openshift/ansible-service-broker/pkg/apb.RHCCRegistry.imageToSpec(0xc420480010, 0x4, 0xc42026ac60, 0x22, 0xc420480040, 0x9, 0x0, 0x0, 0xc420436380, 0x15, ...)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/apb/rhcc_registry.go:130 +0x4bc
github.com/openshift/ansible-service-broker/pkg/apb.RHCCRegistry.LoadSpecs(0xc420480010, 0x4, 0xc42026ac60, 0x22, 0xc420480040, 0x9, 0x0, 0x0, 0xc420436380, 0x15, ...)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/apb/rhcc_registry.go:68 +0x256
github.com/openshift/ansible-service-broker/pkg/apb.(*RHCCRegistry).LoadSpecs(0xc420552360, 0x25befa0, 0x0, 0x0, 0x0, 0x0, 0x0)
	<autogenerated>:5 +0x89
github.com/openshift/ansible-service-broker/pkg/broker.AnsibleBroker.Bootstrap(0xc4206fd800, 0xc42026af30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2546080, ...)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/broker/broker.go:139 +0x2c1
github.com/openshift/ansible-service-broker/pkg/broker.(*AnsibleBroker).Bootstrap(0xc420664c40, 0x0, 0x0, 0x0)
	<autogenerated>:6 +0x85
github.com/openshift/ansible-service-broker/pkg/handler.handler.bootstrap(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42018e300, 0x0, 0x25584e0, ...)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/handler/handler.go:80 +0xad
github.com/openshift/ansible-service-broker/pkg/handler.(handler).(github.com/openshift/ansible-service-broker/pkg/handler.bootstrap)-fm(0x7f8e38ccd410, 0xc4202f1320, 0xc4209f6780, 0xc4202f1350)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/handler/handler.go:58 +0x95
github.com/openshift/ansible-service-broker/pkg/handler.createVarHandler.func1(0x7f8e38ccd410, 0xc4202f1320, 0xc4209f6780)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/handler/handler.go:42 +0x65
net/http.HandlerFunc.ServeHTTP(0xc420400460, 0x7f8e38ccd410, 0xc4202f1320, 0xc4209f6780)
	/usr/lib/golang/src/net/http/server.go:1726 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc420967a70, 0x7f8e38ccd410, 0xc4202f1320, 0xc4209f6780)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/gorilla/mux/mux.go:114 +0x10d
github.com/openshift/ansible-service-broker/pkg/handler.handler.ServeHTTP(0x0, 0x0, 0x0, 0x0, 0xc42036a080, 0x9, 0x10, 0xc42018e300, 0x0, 0x25584e0, ...)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/openshift/ansible-service-broker/pkg/handler/handler.go:85 +0x52
github.com/openshift/ansible-service-broker/pkg/handler.(*handler).ServeHTTP(0xc4204b73b0, 0x7f8e38ccd410, 0xc4202f1320, 0xc4209f65a0)
	<autogenerated>:2 +0xac
github.com/gorilla/handlers.loggingHandler.ServeHTTP(0x2542200, 0xc420038010, 0x2543840, 0xc4204b73b0, 0x2552b00, 0xc420a9a0d0, 0xc4209f65a0)
	/builddir/build/BUILD/ansible-service-broker-0.9.5/src/github.com/gorilla/handlers/handlers.go:69 +0x121
github.com/gorilla/handlers.(*loggingHandler).ServeHTTP(0xc4205c57e0, 0x2552b00, 0xc420a9a0d0, 0xc4209f65a0)
	<autogenerated>:8 +0x8b
net/http.serverHandler.ServeHTTP(0xc42036a400, 0x2552b00, 0xc420a9a0d0, 0xc4209f65a0)
	/usr/lib/golang/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc420098200, 0x2553e00, 0xc4203cf940)
	/usr/lib/golang/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
	/usr/lib/golang/src/net/http/server.go:2293 +0x44d
[2017-07-05T12:55:50.866Z] [INFO] AnsibleBroker::Bootstrap


Expected results:
We should just stop trying to process the image if the label is missing and move on.

Additional info:
I believe this is where we are getting messed up:
https://github.com/openshift/ansible-service-broker/blob/master/pkg/apb/rhcc_registry.go#L134
Comment 4 John Matthews 2017-07-07 06:39:09 EDT
Moving this back to MODIFIED since we have not created a build with this change yet.

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