Michael Ellerman
93900337b9
drivers/macintosh: Fix memleak in windfarm_pm112 driver
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
2020-05-15 11:58:56 +10:00
..
2020-04-10 09:52:15 -07:00
2020-04-01 08:03:28 +02:00
2020-03-23 07:59:38 +01:00
2020-04-16 10:26:52 -06:00
2020-03-25 11:50:48 +01:00
2020-03-23 07:59:38 +01:00
2020-04-07 10:43:41 -07:00
2020-04-13 08:55:49 +02:00
2020-04-03 15:05:35 -07:00
2020-04-10 17:57:48 -07:00
2020-04-13 12:20:07 -07:00
2020-04-05 09:24:58 +02:00
2020-04-06 10:14:39 -07:00
2020-04-30 12:35:26 +10:00
2020-04-20 16:53:14 +10:00
2020-04-02 19:15:03 -07:00
2020-03-25 08:35:03 +09:00
2020-04-10 15:36:22 -07:00
2020-04-08 09:14:34 +10:00
2020-03-30 16:40:08 -07:00
2020-03-25 11:50:48 +01:00
2020-04-03 13:22:40 -07:00
2020-04-14 08:32:15 +02:00
2020-04-04 10:27:00 -07:00
2020-04-16 15:40:02 +10:00
2020-04-01 15:18:42 -07:00
2020-04-14 11:58:04 -07:00
2020-04-18 10:13:07 -07:00
2020-03-25 22:30:46 -07:00
2020-03-24 13:45:24 +01:00
2020-04-15 18:27:31 +02:00
2020-03-29 10:35:50 +02:00
2020-04-04 18:07:59 -07:00
2020-03-30 16:40:08 -07:00
2020-04-08 21:25:49 -07:00
2020-04-01 18:18:18 -07:00
2020-04-07 20:20:12 -07:00
2020-03-20 13:45:25 +01:00
2020-03-27 11:33:27 +01:00
2020-04-17 08:59:55 +01:00
2020-04-16 13:52:31 -07:00
2020-04-06 23:12:08 +02:00
2020-03-30 11:43:51 -07:00
2020-05-15 11:58:56 +10:00
2020-03-19 23:04:32 -05:00
2020-04-08 21:03:40 -07:00
2020-03-30 15:05:01 -07:00
2020-04-03 15:05:35 -07:00
2020-03-26 22:40:47 -04:00
2020-03-30 07:35:28 +01:00
2020-04-08 10:51:53 -07:00
2020-03-31 16:13:09 -07:00
2020-03-24 13:42:44 +01:00
2020-04-09 22:00:13 +02:00
2020-04-16 14:52:29 -07:00
2020-03-25 18:58:11 -07:00
2020-04-03 14:25:02 -07:00
2020-04-08 21:03:40 -07:00
2020-04-10 10:06:54 -07:00
2020-03-25 19:23:49 +01:00
2020-04-17 08:31:34 -05:00
2020-04-13 16:14:55 +05:30
2020-04-05 22:05:23 +02:00
2020-04-08 11:00:00 -07:00
2020-03-31 18:48:22 +02:00
2020-03-31 10:05:01 -07:00
2020-04-03 14:25:02 -07:00
2020-04-04 10:27:00 -07:00
2020-04-16 15:00:57 -07:00
2020-04-10 15:36:22 -07:00
2020-03-30 16:40:08 -07:00
2020-05-11 23:15:15 +10:00
2020-03-30 11:16:38 -07:00
2020-04-03 21:41:42 +02:00
2020-03-30 14:58:26 -07:00
2020-04-03 10:47:21 -07:00
2020-04-07 19:48:52 -07:00
2020-04-17 08:05:27 -06:00
2020-03-18 12:27:04 +01:00
2020-04-13 21:58:48 -04:00
2020-04-09 10:51:30 -07:00
2020-04-03 13:22:40 -07:00
2020-04-02 15:50:04 -07:00
2020-04-10 15:36:21 -07:00
2020-04-13 14:03:20 -04:00
2020-04-03 15:05:35 -07:00
2020-04-07 20:00:16 -07:00
2020-03-23 08:04:08 +01:00
2020-04-05 11:12:59 -07:00
2020-03-18 12:34:10 +01:00
2020-04-02 17:03:53 -07:00
2020-04-02 10:41:40 -04:00
2020-05-11 23:15:15 +10:00
2020-04-02 10:41:40 -04:00
2020-05-11 23:15:15 +10:00
2020-03-19 07:41:03 +01:00
2020-04-08 10:51:53 -07:00
2020-04-08 11:18:38 +02:00
2020-04-17 10:35:17 -07:00
2020-04-03 13:12:26 -07:00
2020-04-08 10:51:53 -07:00
2020-04-08 10:51:53 -07:00