Michael Ellerman
ffd1cebe24
drivers/macintosh: Fix memleak in windfarm_pm112 driver
commit 93900337b9 upstream.
create_cpu_loop() calls smu_sat_get_sdb_partition() which does
kmalloc() and returns the allocated buffer. In fact it's called twice,
and neither buffer is freed.
This results in a memory leak as reported by Erhard:
unreferenced object 0xc00000047081f840 (size 32):
comm "kwindfarm", pid 203, jiffies 4294880630 (age 5552.877s)
hex dump (first 32 bytes):
c8 06 02 7f ff 02 ff 01 fb bf 00 41 00 20 00 00 ...........A. ..
00 07 89 37 00 a0 00 00 00 00 00 00 00 00 00 00 ...7............
backtrace:
[<0000000083f0a65c>] .smu_sat_get_sdb_partition+0xc4/0x2d0 [windfarm_smu_sat]
[<000000003010fcb7>] .pm112_wf_notify+0x104c/0x13bc [windfarm_pm112]
[<00000000b958b2dd>] .notifier_call_chain+0xa8/0x180
[<0000000070490868>] .blocking_notifier_call_chain+0x64/0x90
[<00000000131d8149>] .wf_thread_func+0x114/0x1a0
[<000000000d54838d>] .kthread+0x13c/0x190
[<00000000669b72bc>] .ret_from_kernel_thread+0x58/0x64
unreferenced object 0xc0000004737089f0 (size 16):
comm "kwindfarm", pid 203, jiffies 4294880879 (age 5552.050s)
hex dump (first 16 bytes):
c4 04 01 7f 22 11 e0 e6 ff 55 7b 12 ec 11 00 00 ...."....U{.....
backtrace:
[<0000000083f0a65c>] .smu_sat_get_sdb_partition+0xc4/0x2d0 [windfarm_smu_sat]
[<00000000b94ef7e1>] .pm112_wf_notify+0x1294/0x13bc [windfarm_pm112]
[<00000000b958b2dd>] .notifier_call_chain+0xa8/0x180
[<0000000070490868>] .blocking_notifier_call_chain+0x64/0x90
[<00000000131d8149>] .wf_thread_func+0x114/0x1a0
[<000000000d54838d>] .kthread+0x13c/0x190
[<00000000669b72bc>] .ret_from_kernel_thread+0x58/0x64
Fix it by rearranging the logic so we deal with each buffer
separately, which then makes it easy to free the buffer once we're
done with it.
Fixes: ac171c4666 ("[PATCH] powerpc: Thermal control for dual core G5s")
Cc: stable@vger.kernel.org # v2.6.16+
Reported-by: Erhard F. <erhard_f@mailbox.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Erhard F. <erhard_f@mailbox.org>
Link: https://lore.kernel.org/r/20200423060038.3308530-1-mpe@ellerman.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-20 10:25:19 +02:00
..
2020-06-20 10:25:06 +02:00
2020-05-02 17:24:39 +02:00
2020-04-24 08:00:45 +02:00
2020-06-11 09:23:01 +02:00
2020-05-20 08:17:05 +02:00
2020-04-24 08:00:23 +02:00
2020-06-20 10:25:06 +02:00
2020-05-20 08:17:16 +02:00
2020-06-20 10:25:08 +02:00
2020-05-20 08:17:06 +02:00
2020-06-20 10:25:14 +02:00
2020-06-20 10:25:11 +02:00
2020-03-11 18:02:50 +01:00
2020-05-27 16:43:07 +02:00
2020-03-11 18:02:56 +01:00
2020-06-20 10:25:00 +02:00
2020-06-03 08:17:59 +02:00
2020-06-20 10:25:16 +02:00
2020-06-11 09:22:58 +02:00
2020-05-20 08:17:09 +02:00
2020-04-02 16:34:18 +02:00
2020-06-11 09:22:56 +02:00
2020-02-28 16:36:05 +01:00
2020-06-11 09:23:01 +02:00
2020-06-03 08:18:00 +02:00
2020-06-20 10:24:59 +02:00
2020-06-03 08:18:03 +02:00
2020-04-24 08:01:01 +02:00
2020-06-20 10:25:19 +02:00
2020-06-20 10:25:19 +02:00
2020-06-20 10:25:18 +02:00
2020-04-24 08:00:52 +02:00
2020-05-27 16:43:11 +02:00
2020-06-20 10:25:14 +02:00
2020-05-27 16:42:53 +02:00
2020-06-20 10:25:19 +02:00
2020-06-11 09:22:59 +02:00
2020-06-11 09:22:55 +02:00
2020-06-20 10:25:11 +02:00
2020-06-11 09:23:01 +02:00
2020-04-24 08:01:17 +02:00
2020-06-20 10:25:17 +02:00
2020-04-02 16:34:14 +02:00
2020-06-20 10:25:19 +02:00
2020-06-20 10:25:14 +02:00
2020-06-20 10:25:19 +02:00
2020-05-02 17:24:15 +02:00
2020-05-27 16:43:12 +02:00
2020-05-02 17:24:39 +02:00
2020-04-24 08:01:06 +02:00
2020-04-24 08:01:18 +02:00
2020-06-03 08:18:13 +02:00
2020-06-11 09:22:58 +02:00
2020-04-24 08:01:18 +02:00
2020-06-20 10:25:14 +02:00
2020-06-20 10:25:14 +02:00
2020-05-05 19:15:52 +02:00
2020-02-28 16:36:09 +01:00
2020-06-20 10:24:58 +02:00
2020-06-11 09:23:00 +02:00
2020-05-05 19:15:51 +02:00
2020-05-27 16:42:56 +02:00
2020-06-20 10:25:04 +02:00
2020-02-28 16:36:09 +01:00
2020-02-28 16:36:04 +01:00
2020-05-27 16:42:50 +02:00
2020-06-20 10:25:06 +02:00