Commit 3682930623f63c693845d9620c6bcdf5598c9bbb
Committed by
Dave Jones
1 parent
86cf147494
[CPUFREQ] Fix memory leaks in pcc_cpufreq_do_osc
If acpi_evaluate_object() function call doesn't fail, we must kfree() output.buffer before returning from pcc_cpufreq_do_osc(). Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Dave Jones <davej@redhat.com>
Showing 1 changed file with 12 additions and 6 deletions Side-by-side Diff
arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
... | ... | @@ -368,16 +368,22 @@ |
368 | 368 | return -ENODEV; |
369 | 369 | |
370 | 370 | out_obj = output.pointer; |
371 | - if (out_obj->type != ACPI_TYPE_BUFFER) | |
372 | - return -ENODEV; | |
371 | + if (out_obj->type != ACPI_TYPE_BUFFER) { | |
372 | + ret = -ENODEV; | |
373 | + goto out_free; | |
374 | + } | |
373 | 375 | |
374 | 376 | errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0); |
375 | - if (errors) | |
376 | - return -ENODEV; | |
377 | + if (errors) { | |
378 | + ret = -ENODEV; | |
379 | + goto out_free; | |
380 | + } | |
377 | 381 | |
378 | 382 | supported = *((u32 *)(out_obj->buffer.pointer + 4)); |
379 | - if (!(supported & 0x1)) | |
380 | - return -ENODEV; | |
383 | + if (!(supported & 0x1)) { | |
384 | + ret = -ENODEV; | |
385 | + goto out_free; | |
386 | + } | |
381 | 387 | |
382 | 388 | out_free: |
383 | 389 | kfree(output.pointer); |