Re: [PATCH] ath11k: Fix some resource leaks in error path in 'ath11k_thermal_register()'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-05-13 13:14, Christophe JAILLET wrote:
If 'thermal_cooling_device_register()' fails, we must undo what has been
allocated so far. So we must go to 'err_thermal_destroy' instead of
returning directly

In case of error in 'ath11k_thermal_register()', the previous
'thermal_cooling_device_register()' call must also be undone. Move the
'ar->thermal.cdev = cdev' a few lines above in order for this to be done
in 'ath11k_thermal_unregister()' which is called in the error handling
path.

Fixes: 2a63bbca06b2 ("ath11k: add thermal cooling device support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
I'm not 100% confident with this patch.

- When calling 'ath11k_thermal_unregister()', we try to release some
resources that have not been allocated yet. I don't know if it can be an
  issue or not.
- I think that we should propagate the error code, instead of forcing
  -EINVAL.

Good catch.

-Rajkumar



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux