Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3490885imu; Sun, 11 Nov 2018 16:17:31 -0800 (PST) X-Google-Smtp-Source: AJdET5fg5bPZwrLUx8ZpK652u/Y7lqjsRq7ic1LJ2RA5GuZdfAB5SccyNLKgE6lfK6uulKLkrr5G X-Received: by 2002:a62:2f04:: with SMTP id v4-v6mr14496917pfv.2.1541981851889; Sun, 11 Nov 2018 16:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981851; cv=none; d=google.com; s=arc-20160816; b=Xt9HXl+IRwl8I97Mpy3lC6N3H4CxuPl9mAYnvew3nCdjpBzqBcnOh2smgdjbH8pV2k QLF7cLA53204rrriWAuklFvYJpPWcSk0XgCyPNsETDFeNX9XAwuPaBC1UI/EFfPHyPUj eLGRyHWFEnHhNv39aVzn2JrJSl+Xcp22KeowbfvgtyoDNNV3JQ2T7SZBsY/j2Mf+kET6 U1/Sw5FVts8BPwtsflbK92fVl1tGtBZRagEs/MtTeMblz6zgthmlUsyBVXpVR3mtTFpy hTV4zkofRlZoozuO0UWM5v2e/+MytZfmREXazY1j5ZPCZtQne2+RqIGUodBl2jPMEMoU 8Fxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8ihxHeowcKbGVRyGW5QaGi3MQNG5i02uiJs3Kzj/azw=; b=0COJyGQxTUxL4B/A0bSH/MLTqZF/y8wptxRRVEo1jcOR2pTb8mOqJMcdtOk419hsmK anbHsKAPfjSQ9wUGQXdI9QchME0hZg6dML8NsoC+BQexALNU9Y1NypGwm5W2/HguPrhC WyBbc3sP9GxfD3NizfpABifDD5/dzc2UieZk2oz0YgKHhnLUIVtNtumqYpAoe1c98Yrx egt6EsVFZZuHJ1ZGM9SIgeReb1XInKMn1iiUfmMttWOtCO6xFPD4CiwgOJnShPt+8F+7 0yuAagFZBEkQZ3Oo+8qgUz5Ijz86cQevd+8RF0133ZAgYHGgtN9y6G/1jCIo+1KOn5v3 4W5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qlYX5Ptm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si14185759pgl.85.2018.11.11.16.17.16; Sun, 11 Nov 2018 16:17:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qlYX5Ptm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730285AbeKLIRK (ORCPT + 99 others); Mon, 12 Nov 2018 03:17:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:59684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730175AbeKLIRH (ORCPT ); Mon, 12 Nov 2018 03:17:07 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 59D02214F1; Sun, 11 Nov 2018 22:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975231; bh=8aaKZjDrzRM3UCzV2gYOwDryIOd0DOS32z+K08qRsE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qlYX5PtmVJcLIlB+jPhiFc/OJ3zSk7dBKOCu2Dqy9OC8eocnLsR+dNZhaNghvejQX Ko6lws/9VHjmXTZczC+vK4YsWWIgJS3ScBJu3lNC9kBCOeRQ/LV5Ob+GMuZP0SvrB6 Q31epwbvKyuQZ4sxJg8rVGc/aHc5uMcMgVrM5hY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Arcari , Al Stone , "Rafael J. Wysocki" Subject: [PATCH 4.19 030/361] mailbox: PCC: handle parse error Date: Sun, 11 Nov 2018 14:16:17 -0800 Message-Id: <20181111221623.839314466@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Arcari commit afd0b1fb22269f48d68fdf269891c653818c8047 upstream. acpi_pcc_probe() calls acpi_table_parse_entries_array() but fails to check for an error return. This in turn can result in calling kcalloc() with a negative count as well as emitting the following misleading erorr message: [ 2.642015] Could not allocate space for PCC mbox channels Fixes: 8f8027c5f935 (mailbox: PCC: erroneous error message when parsing ACPI PCCT) Signed-off-by: David Arcari Reviewed-by: Al Stone Cc: 4.18+ # 4.18+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/mailbox/pcc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -461,8 +461,11 @@ static int __init acpi_pcc_probe(void) count = acpi_table_parse_entries_array(ACPI_SIG_PCCT, sizeof(struct acpi_table_pcct), proc, ACPI_PCCT_TYPE_RESERVED, MAX_PCC_SUBSPACES); - if (count == 0 || count > MAX_PCC_SUBSPACES) { - pr_warn("Invalid PCCT: %d PCC subspaces\n", count); + if (count <= 0 || count > MAX_PCC_SUBSPACES) { + if (count < 0) + pr_warn("Error parsing PCC subspaces from PCCT\n"); + else + pr_warn("Invalid PCCT: %d PCC subspaces\n", count); return -EINVAL; }