Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1529451pxb; Thu, 16 Sep 2021 09:18:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwACRJE6WCNQ7K3HSF6GHMZFvHF45pUO4IrHvSpqdw5F1HDDkmt/1aRsG9RaNzYNftZxWzn X-Received: by 2002:a05:6402:5186:: with SMTP id q6mr7556114edd.64.1631809112463; Thu, 16 Sep 2021 09:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631809112; cv=none; d=google.com; s=arc-20160816; b=fNVFciqNY7fcTdRx+kTvzsjrAB1KG3qnepqFAW9BGQED7A2eOhowlZNv4blbTmuCvj sHfwOFdcoyKuvVa2n9mzBng1wJAacXJJ6ONj4mUxt4N3o08d7vu1sD2WrWBlNpp3Wnc2 Isywvz5OBhju8KZMihPDFScupg9YIB5Bs0FPJP1chm9EoV5/BR7HtZn+V03+i7y6Xl+X M/ltDcLuK22kVMbxKcCPJGX5mIGI1Eb/UPpZUh/ZZNYJOmvr1Y7j4pgtQBWxyq7i9cil KwoM0VOu2NXBsW33SK8y50atlKqbLHbtcyhhQSLImBlI3APpe1Z8FAx2D4qK5IiQ2iJg ME6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nR5T+PiERn8/s3qtG+ld6qdb1el3Nn4VRQxzCAH+z+E=; b=pplzmtjT3C0fFygr/5ccyCyaz8pPS6LWLn8YYE1DxewRHj9hysmrgxCq+Izit3ulOE qIsjnvZIrMATX5jC2GJJ6RrY4APXM92/Voy7XCRwBb7CSbsJm4Mdq7sq+GHDzynAhCiU KRpVx0lJAHnZXO79jpWwrbta0t/l62vn3cEFzDeEYSLOYTnxYdG5HlkSg/oMdAXM5Vu4 WM7IQcgJxcGby7VPbVLmq6Lkx9oQVJWkmgwYzsvAFWchT1JpihNrx+AgPtG0dZOX0v/a Q9QRaGFF6ijEJfSRjXOrLuzjmBNAg/Y7YBdn+NXFB/9NoKY3v/H5nw91mwDojTOPAMpL gF/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EI9I64r4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si3810477edw.18.2021.09.16.09.18.06; Thu, 16 Sep 2021 09:18:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EI9I64r4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240956AbhIPQOn (ORCPT + 99 others); Thu, 16 Sep 2021 12:14:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:49222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235352AbhIPQIv (ORCPT ); Thu, 16 Sep 2021 12:08:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2AC1961359; Thu, 16 Sep 2021 16:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808450; bh=jYykw5DaYBpv84no3hzLl5H8/qPz6zA5Xu9ir2aKTc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EI9I64r43JzdXJl3t4E6kkfxE9iLRkxsp9saTx+o5Q+V8Ne7Qc30ti8xdtZt7Od3C GP+Z7JJoAepGQnOWqSI86fnabCWULw0x1aHULBbN/HU2dCTjITl61afRcp+vrz8/kw jdKwm4mq7VixB9J30rjs0RmSIaVkWUNP/KM7qdJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Hans de Goede , Sasha Levin Subject: [PATCH 5.10 095/306] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call Date: Thu, 16 Sep 2021 17:57:20 +0200 Message-Id: <20210916155757.301009958@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit 0487d4fc42d7f31a56cfd9e2237f9ebd889e6112 ] 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 Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20210826140822.71198-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/dell-smbios-wmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c index c97bd4a45242..5821e9d9a4ce 100644 --- a/drivers/platform/x86/dell-smbios-wmi.c +++ b/drivers/platform/x86/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(&priv->buf->std, obj->buffer.pointer, obj->buffer.length); -- 2.30.2