All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call
@ 2021-08-26 14:08 Hans de Goede
  2021-08-27  3:19 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2021-08-26 14:08 UTC (permalink / raw)
  To: Mark Gross, Andy Shevchenko, Dell.Client.Kernel
  Cc: Hans de Goede, platform-driver-x86, Kees Cook

As pointed out be Kees Cook if we return -EIO because the
obj->type != ACPI_TYPE_BUFFER, then we must kfree the
output buffer before the return.

Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/dell/dell-smbios-wmi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c
index 01ea4bb958af..931cc50136de 100644
--- a/drivers/platform/x86/dell/dell-smbios-wmi.c
+++ b/drivers/platform/x86/dell/dell-smbios-wmi.c
@@ -69,6 +69,7 @@ static int run_smbios_call(struct wmi_device *wdev)
 		if (obj->type == ACPI_TYPE_INTEGER)
 			dev_dbg(&wdev->dev, "SMBIOS call failed: %llu\n",
 				obj->integer.value);
+		kfree(output.pointer);
 		return -EIO;
 	}
 	memcpy(input.pointer, obj->buffer.pointer, obj->buffer.length);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call
  2021-08-26 14:08 [PATCH] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call Hans de Goede
@ 2021-08-27  3:19 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2021-08-27  3:19 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Mark Gross, Andy Shevchenko, Dell.Client.Kernel, platform-driver-x86

On Thu, Aug 26, 2021 at 04:08:22PM +0200, Hans de Goede wrote:
> As pointed out be Kees Cook if we return -EIO because the
> obj->type != ACPI_TYPE_BUFFER, then we must kfree the
> output buffer before the return.
> 
> Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
> Reported-by: Kees Cook <keescook@chromium.org>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Excellent! Thanks for doing this. :)

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-27  3:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 14:08 [PATCH] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call Hans de Goede
2021-08-27  3:19 ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.