[U-Boot] [PATCH v4 2/4] dm: core: Fix code reentrancy issue in device_probe_child()

Simon Glass sjg at chromium.org
Wed Aug 26 16:55:50 CEST 2015


On 24 August 2015 at 22:04, Simon Glass <sjg at chromium.org> wrote:
> On 24 August 2015 at 02:14, Bin Meng <bmeng.cn at gmail.com> wrote:
>> The device might have already been probed during the call to
>> device_probe() on its parent device (e.g. PCI bridge devices).
>> In its parent device's probe routine, it might probe all of
>> its child devices via device_probe() thus the codes reenter
>> device_probe_child(). To support code reentrancy, test these
>> allocated memory against NULL to avoid memory leak, and return
>> to the caller if dev->flags has DM_FLAG_ACTIVATED set after
>> device_probe() returns, so that we don't mess up the device.
>>
>> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>>
>> ---
>>
>> Changes in v4:
>> - Fix memory leak in device_probe_child()
>>
>> Changes in v3: None
>>
>>  drivers/core/device.c | 19 ++++++++++++++-----
>>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> Looks like a good solution and it's good to have the comments too.
>
> Acked-by: Simon Glass <sjg at chromium.org>

Applied to u-boot-x86, thanks!


More information about the U-Boot mailing list