greybus: manifest: fix illegal free in error path
The manifest-parsing code could end up leaving the interface vendor_string set to an error pointer that we'd eventually try to free when destroying the interface. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>hifive-unleashed-5.1
parent
d1d67714a4
commit
7d963cbe83
|
@ -384,15 +384,18 @@ static bool gb_manifest_parse_interface(struct gb_interface *intf,
|
||||||
struct manifest_desc *interface_desc)
|
struct manifest_desc *interface_desc)
|
||||||
{
|
{
|
||||||
struct greybus_descriptor_interface *desc_intf = interface_desc->data;
|
struct greybus_descriptor_interface *desc_intf = interface_desc->data;
|
||||||
|
char *str;
|
||||||
|
|
||||||
/* Handle the strings first--they can fail */
|
/* Handle the strings first--they can fail */
|
||||||
intf->vendor_string = gb_string_get(intf, desc_intf->vendor_stringid);
|
str = gb_string_get(intf, desc_intf->vendor_stringid);
|
||||||
if (IS_ERR(intf->vendor_string))
|
if (IS_ERR(str))
|
||||||
return false;
|
return false;
|
||||||
|
intf->vendor_string = str;
|
||||||
|
|
||||||
intf->product_string = gb_string_get(intf, desc_intf->product_stringid);
|
str = gb_string_get(intf, desc_intf->product_stringid);
|
||||||
if (IS_ERR(intf->product_string))
|
if (IS_ERR(str))
|
||||||
goto out_free_vendor_string;
|
goto out_free_vendor_string;
|
||||||
|
intf->product_string = str;
|
||||||
|
|
||||||
/* Release the interface descriptor, now that we're done with it */
|
/* Release the interface descriptor, now that we're done with it */
|
||||||
release_manifest_descriptor(interface_desc);
|
release_manifest_descriptor(interface_desc);
|
||||||
|
|
Loading…
Reference in New Issue