diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-04 20:19:14 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-04 20:19:14 +0100 |
commit | a4ffdb61035da6e1550c3cb141a6b25acd7ae3da (patch) | |
tree | 070a5b1829249d7792082a5cf8f1ffb6e3e45bc9 | |
parent | Merge tag 'sound-5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/t... (diff) | |
parent | thermal: core: Fix TZ_GET_TRIP NULL pointer dereference (diff) | |
download | linux-a4ffdb61035da6e1550c3cb141a6b25acd7ae3da.tar.xz linux-a4ffdb61035da6e1550c3cb141a6b25acd7ae3da.zip |
Merge tag 'thermal-5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fix from Rafael Wysocki:
"Fix NULL pointer dereference in the thermal netlink interface (Nicolas
Cavallari)"
* tag 'thermal-5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: core: Fix TZ_GET_TRIP NULL pointer dereference
-rw-r--r-- | drivers/thermal/thermal_netlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c index a16dd4d5d710..73e68cce292e 100644 --- a/drivers/thermal/thermal_netlink.c +++ b/drivers/thermal/thermal_netlink.c @@ -419,11 +419,12 @@ static int thermal_genl_cmd_tz_get_trip(struct param *p) for (i = 0; i < tz->trips; i++) { enum thermal_trip_type type; - int temp, hyst; + int temp, hyst = 0; tz->ops->get_trip_type(tz, i, &type); tz->ops->get_trip_temp(tz, i, &temp); - tz->ops->get_trip_hyst(tz, i, &hyst); + if (tz->ops->get_trip_hyst) + tz->ops->get_trip_hyst(tz, i, &hyst); if (nla_put_u32(msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, i) || nla_put_u32(msg, THERMAL_GENL_ATTR_TZ_TRIP_TYPE, type) || |