Fix use-after-free in endo-registration error path by moving the
id-release to the device release function.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
{
struct gb_endo *endo = to_gb_endo(dev);
+ ida_simple_remove(&greybus_endo_id_map, endo->dev_id);
kfree(endo);
}
dev_err(hd->parent, "failed to add endo device of id 0x%04x\n",
endo->id);
put_device(&endo->dev);
- ida_simple_remove(&greybus_endo_id_map, endo->dev_id);
}
return retval;
/* remove all modules for this endo */
gb_module_remove_all(endo);
- ida_simple_remove(&greybus_endo_id_map, endo->dev_id);
device_unregister(&endo->dev);
}