Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2173676imm; Mon, 28 May 2018 03:12:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqv3+/XmC5bNY2Udg9nAZ0VxjJd9yUy5WtRsi5DSo+m7etb/LkGdcPTDlewYr9uLbqYZz4T X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr13261639plk.256.1527502371293; Mon, 28 May 2018 03:12:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527502371; cv=none; d=google.com; s=arc-20160816; b=lmDBstmofp1cYhqu2B2oRTn6vtzPg6nflS03//0HExG5z4qvRMgt2UzWWShFl4jjUA 5sLFse2407TVbjAzodmwZ1vnx4/6qkbAGU3/niv6cU4itcAW+27nfsh+bv5NOU3kSXfl C7lH/lPgyZcClzA6P+fkDRVmlkMWmBWe9kx5XVDcboCgiYErcvjEzCtLGLiO/TmTtVOs sQH2XTYkL/NKX40zbCvGdnOVzj8roIdY9P6d54mEAZMn6J8JLAMLrUfA2YHNF2wVjuix mz10Vk13rywH11M//VOZxvxnex4EzHlXmqrKQSpe663tK3K9Vro0DllWlJl7xVfjwkL2 ORIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UxD8et3W8EfkHnD6BHacg1NSWudcgljz1Cx1/pt9O1s=; b=ffVdgcD1+obpUAYAOU+EDtEEvOYPKiRA69piq+Bb3Zt++SwLTUBB/4kIOdTYnyqi7U 6ez1ikGgBUboiGS38o/T/5wDL416l65uQQJO5SUzSO6Id3HGfVqWoSzgO06llOYEWiM/ v9Z8QPnn9ce+v7WfRL2Vj0BFnGjo+kiEUsz9uGHupV5kvT46j1K+nEYZDUPQEJpwDdeP SRt/Ls68Q9//CrLq4crZzE2ZOCxvbXv16FLdicJlH1StlFc7HXytTMyW3aHGS3kmW0dg 3p7OW0YF//1y7Br0OXU2TIBa4Aqy57hcPkm0+UNbuNadT8UgVRTeeoo792X8dmB8UH8v 3XSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S6sVYv5Z; 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 l125-v6si17099233pgl.410.2018.05.28.03.12.36; Mon, 28 May 2018 03:12:51 -0700 (PDT) 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=S6sVYv5Z; 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 S936593AbeE1KL0 (ORCPT + 99 others); Mon, 28 May 2018 06:11:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:59520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936567AbeE1KLS (ORCPT ); Mon, 28 May 2018 06:11:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 466A32086D; Mon, 28 May 2018 10:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502277; bh=0RyKInzYHRqEDmZmHdH3ZfRRxYvfGSg4Bz+OU3DFqas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S6sVYv5Z2zBDvWSDa7dne/e+Xl55SxJAfrzw8af5+OqJ5IVQkgg7EEqwTtCrOjYwL tO3hkkS0KWi7a+8Q+X3SwexZzCObPQCkuVi0Nkr7csYHBEyoJ0XjDx5B3vxQOJTo3T yFO5wQU8AXAaYnP/qNMObCjpSnAAuVaDnoK3Xb20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Joao Martins , Juergen Gross , Boris Ostrovsky , Sasha Levin Subject: [PATCH 3.18 127/185] xen/acpi: off by one in read_acpi_id() Date: Mon, 28 May 2018 12:02:48 +0200 Message-Id: <20180528100103.735618261@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit c37a3c94775855567b90f91775b9691e10bd2806 ] If acpi_id is == nr_acpi_bits, then we access one element beyond the end of the acpi_psd[] array or we set one bit beyond the end of the bit map when we do __set_bit(acpi_id, acpi_id_present); Fixes: 59a568029181 ("xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.") Signed-off-by: Dan Carpenter Reviewed-by: Joao Martins Reviewed-by: Juergen Gross Signed-off-by: Boris Ostrovsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xen-acpi-processor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c @@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl } /* There are more ACPI Processor objects than in x2APIC or MADT. * This can happen with incorrect ACPI SSDT declerations. */ - if (acpi_id > nr_acpi_bits) { - pr_debug("We only have %u, trying to set %u\n", - nr_acpi_bits, acpi_id); + if (acpi_id >= nr_acpi_bits) { + pr_debug("max acpi id %u, trying to set %u\n", + nr_acpi_bits - 1, acpi_id); return AE_OK; } /* OK, There is a ACPI Processor object */