Skip to content

Commit

Permalink
Merge tag 'thermal-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/thermal/linux

Pull thermal fixes from Daniel Lezcano:

 - Fix thermal shutdown after a suspend/resume due to a wrong TCC value
   restored on Intel platform (Antoine Tenart)

 - Fix potential buffer overflow when building the list of policies. The
   buffer size is not updated after writing to it (Dan Carpenter)

 - Fix wrong check against IS_ERR instead of NULL (Ansuel Smith)

* tag 'thermal-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
  thermal/drivers/tsens: Fix wrong check for tzd in irq handlers
  thermal/core: Potential buffer overflow in thermal_build_list_of_policies()
  thermal/drivers/int340x: Do not set a wrong tcc offset on resume
  • Loading branch information
torvalds committed Sep 26, 2021
2 parents 5bb7b21 + cf96921 commit 299d6e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int tcc_offset_update(unsigned int tcc)
return 0;
}

static unsigned int tcc_offset_save;
static int tcc_offset_save = -1;

static ssize_t tcc_offset_degree_celsius_store(struct device *dev,
struct device_attribute *attr, const char *buf,
Expand Down Expand Up @@ -352,7 +352,8 @@ int proc_thermal_resume(struct device *dev)
proc_dev = dev_get_drvdata(dev);
proc_thermal_read_ppcc(proc_dev);

tcc_offset_update(tcc_offset_save);
if (tcc_offset_save >= 0)
tcc_offset_update(tcc_offset_save);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/thermal/qcom/tsens.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static irqreturn_t tsens_critical_irq_thread(int irq, void *data)
const struct tsens_sensor *s = &priv->sensor[i];
u32 hw_id = s->hw_id;

if (IS_ERR(s->tzd))
if (!s->tzd)
continue;
if (!tsens_threshold_violated(priv, hw_id, &d))
continue;
Expand Down Expand Up @@ -467,7 +467,7 @@ static irqreturn_t tsens_irq_thread(int irq, void *data)
const struct tsens_sensor *s = &priv->sensor[i];
u32 hw_id = s->hw_id;

if (IS_ERR(s->tzd))
if (!s->tzd)
continue;
if (!tsens_threshold_violated(priv, hw_id, &d))
continue;
Expand Down
7 changes: 3 additions & 4 deletions drivers/thermal/thermal_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,14 @@ int thermal_build_list_of_policies(char *buf)
{
struct thermal_governor *pos;
ssize_t count = 0;
ssize_t size = PAGE_SIZE;

mutex_lock(&thermal_governor_lock);

list_for_each_entry(pos, &thermal_governor_list, governor_list) {
size = PAGE_SIZE - count;
count += scnprintf(buf + count, size, "%s ", pos->name);
count += scnprintf(buf + count, PAGE_SIZE - count, "%s ",
pos->name);
}
count += scnprintf(buf + count, size, "\n");
count += scnprintf(buf + count, PAGE_SIZE - count, "\n");

mutex_unlock(&thermal_governor_lock);

Expand Down

0 comments on commit 299d6e4

Please sign in to comment.