Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'thermal-v5.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux

Pull thermal fixes from Daniel Lezcano:

- Fix bogus thermal shutdowns for omap4430 where bogus values resulting
from an incorrect ADC conversion are too high and fire an emergency
shutdown (Tony Lindgren)

- Don't suppress negative temp for qcom spmi as they are valid and
userspace needs them (Veera Vegivada)

- Fix use-after-free in thermal_zone_device_unregister reported by
Kasan (Dmitry Osipenko)

* tag 'thermal-v5.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
thermal: core: Fix use-after-free in thermal_zone_device_unregister()
thermal: qcom-spmi-temp-alarm: Don't suppress negative temp
thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430

+24 -18
+2 -2
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (c) 2011-2015, 2017, The Linux Foundation. All rights reserved. 3 + * Copyright (c) 2011-2015, 2017, 2020, The Linux Foundation. All rights reserved. 4 4 */ 5 5 6 6 #include <linux/bitops.h> ··· 191 191 chip->temp = mili_celsius; 192 192 } 193 193 194 - *temp = chip->temp < 0 ? 0 : chip->temp; 194 + *temp = chip->temp; 195 195 196 196 return 0; 197 197 }
+3 -2
drivers/thermal/thermal_core.c
··· 1516 1516 */ 1517 1517 void thermal_zone_device_unregister(struct thermal_zone_device *tz) 1518 1518 { 1519 - int i; 1519 + int i, tz_id; 1520 1520 const struct thermal_zone_params *tzp; 1521 1521 struct thermal_cooling_device *cdev; 1522 1522 struct thermal_zone_device *pos = NULL; ··· 1525 1525 return; 1526 1526 1527 1527 tzp = tz->tzp; 1528 + tz_id = tz->id; 1528 1529 1529 1530 mutex_lock(&thermal_list_lock); 1530 1531 list_for_each_entry(pos, &thermal_tz_list, node) ··· 1568 1567 mutex_destroy(&tz->lock); 1569 1568 device_unregister(&tz->device); 1570 1569 1571 - thermal_notify_tz_delete(tz->id); 1570 + thermal_notify_tz_delete(tz_id); 1572 1571 } 1573 1572 EXPORT_SYMBOL_GPL(thermal_zone_device_unregister); 1574 1573
+12 -11
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c
··· 37 37 38 38 /* 39 39 * Temperature values in milli degree celsius 40 - * ADC code values from 530 to 923 40 + * ADC code values from 13 to 107, see TRM 41 + * "18.4.10.2.3 ADC Codes Versus Temperature". 41 42 */ 42 43 static const int 43 44 omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = { 44 - -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000, 45 - -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000, 46 - -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000, 47 - 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000, 48 - 32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000, 49 - 48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000, 50 - 66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000, 51 - 83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000, 52 - 100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000, 53 - 117000, 118000, 120000, 122000, 123000, 45 + -40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, 46 + -22000, -20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000, 47 + -6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000, 48 + 12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500, 49 + 30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000, 50 + 47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000, 51 + 64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000, 52 + 82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000, 53 + 98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000, 54 + 115000, 117000, 118500, 120000, 122000, 123500, 125000, 54 55 }; 55 56 56 57 /* OMAP4430 data */
+7 -3
drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h
··· 53 53 * and thresholds for OMAP4430. 54 54 */ 55 55 56 - /* ADC conversion table limits */ 57 - #define OMAP4430_ADC_START_VALUE 0 58 - #define OMAP4430_ADC_END_VALUE 127 56 + /* 57 + * ADC conversion table limits. Ignore values outside the TRM listed 58 + * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter 59 + * "18.4.10.2.3 ADC Codes Versus Temperature". 60 + */ 61 + #define OMAP4430_ADC_START_VALUE 13 62 + #define OMAP4430_ADC_END_VALUE 107 59 63 /* bandgap clock limits (no control on 4430) */ 60 64 #define OMAP4430_MAX_FREQ 32768 61 65 #define OMAP4430_MIN_FREQ 32768