Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1737005pxb; Thu, 16 Sep 2021 14:23:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySH7fLzZPqLGKn0JP1EbB4XAM8ZaHIQeZK5xuIGIcPid4NNf0LiT4yLvXjdG6mlekmZzAS X-Received: by 2002:a92:da4a:: with SMTP id p10mr5591576ilq.13.1631827399648; Thu, 16 Sep 2021 14:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631827399; cv=none; d=google.com; s=arc-20160816; b=nxgQVpnFw6PzEE7OXMWHl2mqAwF7or912i1ttg3NXKdY3Aj90wPTZzL5CRlV1m3Qbt HLrI3rFss7MP9NFKr+2qKoxWu4h8D+SKpyuCbly20iJ1ybF4/9bC0qVGreC0UXBXKC7u rmhOgn9cPtJvXzCXsE5V9hgYx2DM9pbCjm2hMLeS/uTmC85whHXjLQ04UGeEi7X7ITAR GkyZl8lf/kLkb3ubnGrp6429kuMFOKzunP/PGnjU5qhUzaZplgyW288BG5HTmgWl6mji xWuuvtlaAMoA53IjCpleNFrilY7aAFyQs625WfsOua11PhPOFHjsPfAq6c9qmoCd0n7E lI3w== 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=0SiIpJPT+iXxsM2rCyrTD/yP+59DV9qyUvdRT3jWQEI=; b=fh+PE5BTO6klELYmPEwl2kYUwYvILhFaPDAW6SHSsOlHxCcpgO21xNfPauSyYrLVxY Bo3IWEV48kckLDgYsa2CaoLhF7/l65SDAO48f7UKr7wgvq6PspXNUYf7/qOOBXF434IS ytbuYF7cyNUmIZ3dcYgzvotKAEvdygDlW9djFre0uxD53/6KfuzSPbez2LlTuXdlpEyt Hi6Iif3S9Lmb+ui4yIkVW3aXFHbw5bvjRYWJAVHCYBbYnCobdFUmerdeLCaMHdbPEznv fiNK45d2QjTKZlwZxoaJiV+pTunfEFBHBSLzaMAX2yVlX9lun637oqsjben7g7SdUcBG Cc4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i4a42AdD; 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 q6si3480180ilv.123.2021.09.16.14.23.09; Thu, 16 Sep 2021 14:23:19 -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=i4a42AdD; 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 S244441AbhIPQnT (ORCPT + 99 others); Thu, 16 Sep 2021 12:43:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:51976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242842AbhIPQhs (ORCPT ); Thu, 16 Sep 2021 12:37:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C271861425; Thu, 16 Sep 2021 16:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809347; bh=j04BCEHtGVhSUxIRHf3111GH6/tzw6YkuSc2gPg4M+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i4a42AdDnR9QKPYKd0sZPoxEqXbETFOeVQuh0zDcch1o++GHag0It+625gh4pEX5P UkyO1OadubldWh+nshBfjg/uyP/3W1SsruXEp8QGwO/81Dzije5klbFxO9/RL3Hf0c 8gX59jkqpDUuY3tZQTr0UgfN+2dNyq4NzTmvphOM= 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.13 122/380] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call Date: Thu, 16 Sep 2021 17:57:59 +0200 Message-Id: <20210916155808.198418822@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@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/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 33f823772733..8e761991455a 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(&priv->buf->std, obj->buffer.pointer, obj->buffer.length); -- 2.30.2