greybus: manifest: reserve control connection cport/bundle ids
5ae6906e ('interface: Get manifest using Control protocol') in
gb_create_control_connection introduces the concept that the Control
Protocol is at cport_id 2 and bundle_id 0. Currently the manifest parsing
code does not enforce that concept and as a result it is possible for a
manifest to declare the Control Protocol at a different address.
Based on that change
6a6945c9684e ('greybus-spec/control: Formally define
Control Protocol reserved addresses') makes the above coding convention a
formal requirement of the greybus specification. This patch implements the
change introduced in the specification @
6a6945c9684e.
This patch will reject a manifest if it doesn't match the critiera laid
down in the spec.
This patch makes three changes:
- Changes gb_manifest_parse_cports so that only GB_CONTROL_CPORT_ID may
have a protocol_id of GREYBUS_PROTOCOL_CONTROL, otherwise the manifest
will be rejected.
- Changes gb_manifest_parse_bundles so that only GB_CONTROL_BUNDLE_ID may
have a class of GREYBUS_CLASS_CONTROL, otherwise the manifest will be
rejected.
- gb_connection_exit() and gb_connection_destroy() are removed from
gb_manifest_parse_cports on error - since gb_manifest_parse_bundles()
already has a call into gb_bundle_destroy() which will again call
gb_connection_exit() and gb_connection_destroy() leading to an oops.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>