Thermal control fix for 5.17-rc7

Fix NULL pointer dereference in the thermal netlink interface (Nicolas
 Cavallari).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmIiWzUSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRx8VkP/RH2rrAitrQoSAaCH1MSgFZm00X61UxL
 4hkhRGBvhyQpjvcWg8qUH8uIl+v0es7H9YUIGwCFlFc9OUR0bvRKVQ4Ikqc0tQZd
 wPz4Adtcp6mkfotvrrA1fnPXZEPXiw20jkM5d0CccaoepRaDuC0iN3JjiqVSFu8Y
 aOL+a8BZVhsYXfKrkZpbjHBm2zVCW6ROGf5yew/g/Q77W4R77RGTgRq5WXYoftX+
 UCqLnFgWm6kuWfxpkjlPKiwUA5NBZLjDerKfn8K0H6ym/TCKUz+Ujb306KWYvdDr
 1dOMC2eI+nz+Jm8ymC357lXd+LZGOE+VMv+cUN/bOAwYz8PYpO8pTExjceu1xhLO
 3ZeMQnBmzGYYUK8VT/s0dAD6WB+W7dXCQlaq903EsK9c9bHHhy4rMp9MhBmdvyMP
 r/KJ7cvnRtTbSJytTnpv6vQs3KWjw+4dwsm1U8V8a/GsH2tSCwjVaY2sqStig/3s
 aPwWy6JUVFgecvqGb80Xv8uJw+iIqz/ANRiVVBL53K18YLhoKK4M4TkQThIusXIe
 NEg7D5EK7OH35sljbpIkq5o2aeHDK9ADPjpkp+jq83I8c7Yuyvs1znv8QpMZGW++
 6ErTpQReLoRuqasGLApkTqz0FMbjORp3O8JVlvERCNNUwT/KH0+Ts2P/od/cSR2P
 fRAcxCNJSx1Z
 =V33r
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-03-04 11:19:14 -08:00
commit a4ffdb6103

View file

@ -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) ||