Commit 55b930cd authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

greybus: manifest: Warn if descriptor size > expected size

A descriptor passed to AP can be bigger than what AP expects, if
manifest's minor version is higher with same major number as the AP. As
it can have some extra data in descriptor.

But, if AP and manifest versions are identical, or if the AP's minor
version is greater than the manifest version, we should at least warn
(if not fail).

Doing this would require some changes to record the manifest version
somewhere reachable by identify_descriptor().

For now, just warn if descriptor is bigger than expected.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent fa2fbf16
...@@ -129,6 +129,13 @@ static int identify_descriptor(struct gb_interface *intf, ...@@ -129,6 +129,13 @@ static int identify_descriptor(struct gb_interface *intf,
return -EINVAL; return -EINVAL;
} }
/* Descriptor bigger than what we expect */
if (desc_size > expected_size) {
pr_warn("%s descriptor size mismatch (want %zu got %zu)\n",
get_descriptor_type_string(desc_header->type),
expected_size, desc_size);
}
descriptor = kzalloc(sizeof(*descriptor), GFP_KERNEL); descriptor = kzalloc(sizeof(*descriptor), GFP_KERNEL);
if (!descriptor) if (!descriptor)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment