From: Greg Kroah-Hartman Date: Tue, 7 Feb 2023 11:44:16 +0000 (+0100) Subject: 4.19-stable patches X-Git-Tag: v5.15.93~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a400d80a6bb174a0537fce611f1540933dfc1da4;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: thermal-intel-int340x-add-locking-to-int340x_thermal_get_trip_type.patch --- diff --git a/queue-4.19/series b/queue-4.19/series index e187816bd94..9a2a67ea2ee 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -38,3 +38,4 @@ mm-swapfile-add-cond_resched-in-get_swap_pages.patch squashfs-fix-handling-and-sanity-checking-of-xattr_ids-count.patch serial-8250_dma-fix-dma-rx-completion-race.patch serial-8250_dma-fix-dma-rx-rearm-race.patch +thermal-intel-int340x-add-locking-to-int340x_thermal_get_trip_type.patch diff --git a/queue-4.19/thermal-intel-int340x-add-locking-to-int340x_thermal_get_trip_type.patch b/queue-4.19/thermal-intel-int340x-add-locking-to-int340x_thermal_get_trip_type.patch new file mode 100644 index 00000000000..b82be336322 --- /dev/null +++ b/queue-4.19/thermal-intel-int340x-add-locking-to-int340x_thermal_get_trip_type.patch @@ -0,0 +1,52 @@ +From acd7e9ee57c880b99671dd99680cb707b7b5b0ee Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 25 Jan 2023 13:17:42 +0100 +Subject: thermal: intel: int340x: Add locking to int340x_thermal_get_trip_type() + +From: Rafael J. Wysocki + +commit acd7e9ee57c880b99671dd99680cb707b7b5b0ee upstream. + +In order to prevent int340x_thermal_get_trip_type() from possibly +racing with int340x_thermal_read_trips() invoked by int3403_notify() +add locking to it in analogy with int340x_thermal_get_trip_temp(). + +Fixes: 6757a7abe47b ("thermal: intel: int340x: Protect trip temperature from concurrent updates") +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/thermal/int340x_thermal/int340x_thermal_zone.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c ++++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c +@@ -89,11 +89,13 @@ static int int340x_thermal_get_trip_type + enum thermal_trip_type *type) + { + struct int34x_thermal_zone *d = zone->devdata; +- int i; ++ int i, ret = 0; + + if (d->override_ops && d->override_ops->get_trip_type) + return d->override_ops->get_trip_type(zone, trip, type); + ++ mutex_lock(&d->trip_mutex); ++ + if (trip < d->aux_trip_nr) + *type = THERMAL_TRIP_PASSIVE; + else if (trip == d->crt_trip_id) +@@ -111,10 +113,12 @@ static int int340x_thermal_get_trip_type + } + } + if (i == INT340X_THERMAL_MAX_ACT_TRIP_COUNT) +- return -EINVAL; ++ ret = -EINVAL; + } + +- return 0; ++ mutex_unlock(&d->trip_mutex); ++ ++ return ret; + } + + static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,