Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2565864lkm; Mon, 20 Sep 2021 18:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKYUeB9dzNypIr9FLKeU/yb679cy7Sgh0Sm0SXv6PPCwnCgyWZ9o/BFhme98EXuMno7uaK X-Received: by 2002:a05:6e02:1525:: with SMTP id i5mr14259580ilu.122.1632189046991; Mon, 20 Sep 2021 18:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189046; cv=none; d=google.com; s=arc-20160816; b=FByAwO/5TF41pLODYhVsW0UjK9Byo4mbtjBql1P3TuZqgrxzsJIElCbtkElCe85JIO dCBYugi23YaUP5mrw0KA3OjEaaAH9p+Yyd0zOa57vnxQ32gH0QFpuRF+JigtWWpv2lwk SKAaHVjSq7tGXNQJntQruFGtOby+OQiMMFtczfvELd6h6mfLPeDhjwi79cttx1mWmU8t 40WUf226Sleg6+LyOeohGOCGPqBclo9SEBmDcJt7fYDaf25OaSOaiLHfjojN+KVJtGmj NP1IEOlfrmy5QAEIkjmQT0pVo1qXZEz/jy7gX03iHkOnlza0isViSvKfQy396KAhG3KZ ZeXw== 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=zVLBnaPGDoRZk7z282d3tdLMnqxveJO2zIGJH9/RVIZDxlHCVX+4+JFmR5orAgN3yh n2FCIbfhCpfqtQsbnHZtjINkW+HEdSQD2icQyFhO0glsi5WLqqtHc2YRZnRe7KUpnIek YsZ4AiaL5ITFbHO7H80RcNZZOASKZJDzAXRfqFMdYPzN/8dBsZ4gJqiHSKgP7Bfaiq3a kEUz3PcDBlbuXx30xHa0kSXabu2sOwpLxRbjuX0D1uqt2OeeALyIQCz2OiVzINMPO7sr 21yt/BNF5mIg1SHdSQ7MBrjs+Vd/gd+rvWDAfPfdJEOPZdIVIncQ511uY9PDYY73TkQO pb8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qvvgZ6F/"; 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 191si3261977jaw.1.2021.09.20.18.50.36; Mon, 20 Sep 2021 18:50:46 -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="qvvgZ6F/"; 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 S1359101AbhITSJP (ORCPT + 99 others); Mon, 20 Sep 2021 14:09:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:33250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357518AbhITSE0 (ORCPT ); Mon, 20 Sep 2021 14:04:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE35B61A04; Mon, 20 Sep 2021 17:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158228; bh=jYykw5DaYBpv84no3hzLl5H8/qPz6zA5Xu9ir2aKTc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvvgZ6F/UccMr50T3v1s6D8cwJyCHjpdVg7fggPNdVNPwFR+PHygvDO3ZSlUDJRn/ wRlAiNirLpWWwTTiX0XMAHaLZ1h2wgY2oc54kSYydDrwc3l9hR/RxXTQGliacUTFWh Ujiq4ZOom0rdEoqIJ8sXw6N2rGdH8DSmg1TpcpRc= 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.4 060/260] platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call Date: Mon, 20 Sep 2021 18:41:18 +0200 Message-Id: <20210920163933.164087834@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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