Skip to content

Commit 5838a14

Browse files
Nicolas Cavallarirafaeljw
authored andcommitted
thermal: core: Fix TZ_GET_TRIP NULL pointer dereference
Do not call get_trip_hyst() from thermal_genl_cmd_tz_get_trip() if the thermal zone does not define one. Fixes: 1ce50e7 ("thermal: core: genetlink support for events/cmd/sampling") Signed-off-by: Nicolas Cavallari <[email protected]> Cc: 5.10+ <[email protected]> # 5.10+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7e57714 commit 5838a14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/thermal/thermal_netlink.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,12 @@ static int thermal_genl_cmd_tz_get_trip(struct param *p)
419419
for (i = 0; i < tz->trips; i++) {
420420

421421
enum thermal_trip_type type;
422-
int temp, hyst;
422+
int temp, hyst = 0;
423423

424424
tz->ops->get_trip_type(tz, i, &type);
425425
tz->ops->get_trip_temp(tz, i, &temp);
426-
tz->ops->get_trip_hyst(tz, i, &hyst);
426+
if (tz->ops->get_trip_hyst)
427+
tz->ops->get_trip_hyst(tz, i, &hyst);
427428

428429
if (nla_put_u32(msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, i) ||
429430
nla_put_u32(msg, THERMAL_GENL_ATTR_TZ_TRIP_TYPE, type) ||

0 commit comments

Comments
 (0)