mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
icnss2: Fix null-pointer derefrence while thermal unregister
Structure pointer added in list was not deleted properly. Delete list in proper sequence and free pointer. Change-Id: I9a5deb0801ec7366d0be7049e8771016a3bbdf44 Signed-off-by: Naman Padhiar <npadhiar@codeaurora.org>
This commit is contained in:
parent
9297104f83
commit
380c17f3dc
1 changed files with 5 additions and 2 deletions
|
|
@ -1887,7 +1887,7 @@ int icnss_thermal_cdev_register(struct device *dev, unsigned long max_state,
|
|||
struct device_node *dev_node;
|
||||
int ret = 0;
|
||||
|
||||
icnss_tcdev = devm_kzalloc(dev, sizeof(*icnss_tcdev), GFP_KERNEL);
|
||||
icnss_tcdev = kzalloc(sizeof(*icnss_tcdev), GFP_KERNEL);
|
||||
if (!icnss_tcdev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1934,7 +1934,10 @@ void icnss_thermal_cdev_unregister(struct device *dev, int tcdev_id)
|
|||
struct icnss_priv *priv = dev_get_drvdata(dev);
|
||||
struct icnss_thermal_cdev *icnss_tcdev = NULL;
|
||||
|
||||
list_for_each_entry(icnss_tcdev, &priv->icnss_tcdev_list, tcdev_list) {
|
||||
while (!list_empty(&priv->icnss_tcdev_list)) {
|
||||
icnss_tcdev = list_first_entry(&priv->icnss_tcdev_list,
|
||||
struct icnss_thermal_cdev,
|
||||
tcdev_list);
|
||||
thermal_cooling_device_unregister(icnss_tcdev->tcdev);
|
||||
list_del(&icnss_tcdev->tcdev_list);
|
||||
kfree(icnss_tcdev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue