Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3074253yba; Mon, 6 May 2019 16:47:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxr/1HeIAwT+RGNFxUXjzlRbqLzYdJcI5vySQi/pSbdlsXzUZIji2s+R9TI5Rh7zI3vDG9 X-Received: by 2002:a17:902:bd92:: with SMTP id q18mr36212149pls.136.1557186442882; Mon, 06 May 2019 16:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557186442; cv=none; d=google.com; s=arc-20160816; b=IvAVywSTJflvcwoLEn6h/LjyBxv353T8QtWBK3ej9Tgn2FnG1mcmBzdntkbyWu+gTv N+uw/84X5CXTxp63lTo2CqTWFUt/FI8L65yNstlQIMkWbUlAxvjiwpeNFsorF7TKiVA6 ylk7y3DVG6pBocYG8bImRmIK+LZeIzLfPS0PNayHDdnc7O7nFqrqPaoavvV+5gjUPtHA sVIq6zOBQUSrFiKbOt/7E/fKPdHriDs0r0rg6ZTIxCVdIrf5n3yWQzJ84foxRPC7ZgxQ LsrezxcDiy+/c7ketXKnAOOjsiLwUNJpCNhRljT4477uClV+1jW/QoB87XAGdrrQlpjh 2ePA== 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 :references:in-reply-to:date:to:from:subject:message-id; bh=xIOM070vn5r9mlpHV6i7n6T3Gsz0JFF9h1Jd7nZMoxA=; b=n1Xo5UcH1V0nTc4lPERLQk7fZksK9bTymZrcJb73b+di6Sl9B2Gs/NoMkrlIU9GYuG 1x6TELTPu9CgUtl+WIU8CIJUPGG/SL92+f7CklYXJ/FsNoT2XteZDgyYY1CC3M281aio Fcdm84EkW7zPapPPl6Iu7tLTaEi/fG6Q9az/qiwOhzkpFdvETd2m+uQB5aj+sjUqlWjM O641cnZKR8ETdunj1XsiutWfWof9157eCfw/6Vi1bQB9TGuk+CGiY70NTCwrR1RqQOUt nV6NxeAEbcGzaRgYAuDU1WEqb4hLr5LPeV0AituVOmFYLlCPv3vI0WqlM55xfysz+h91 BvFg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o15si15479025pgv.316.2019.05.06.16.47.06; Mon, 06 May 2019 16:47:22 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbfEFXqR (ORCPT + 99 others); Mon, 6 May 2019 19:46:17 -0400 Received: from mga09.intel.com ([134.134.136.24]:15462 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbfEFXqQ (ORCPT ); Mon, 6 May 2019 19:46:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 May 2019 16:46:15 -0700 X-ExtLoop1: 1 Received: from spandruv-mobl3.jf.intel.com ([10.251.2.135]) by orsmga002.jf.intel.com with ESMTP; 06 May 2019 16:46:15 -0700 Message-ID: Subject: Re: ACPI / LPIT: Correct LPIT end address for lpit_process() From: Srinivas Pandruvada To: Lenny Szubowicz , rjw@rjwysocki.net, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 06 May 2019 16:46:15 -0700 In-Reply-To: <20190502200052.26754-1-lszubowi@redhat.com> References: <20190502200052.26754-1-lszubowi@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-3.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-05-02 at 16:00 -0400, Lenny Szubowicz wrote: > Correct the LPIT end address which is passed into lpit_process() > and the end address limit test in lpit_process(). > > The LPI state descriptor subtables follow the fixed sized > acpi_lpit_header up to the end of the LPIT. The last LPI state > descriptor can end at exactly the end of the LPIT. > > Note that this is a fix to a latent problem. Although incorrect, > the unpatched version works because the passed in end address > is just slightly beyond the actual end of the LPIT and the size > of the ACPI LPIT header is smaller than the size of the only > currently defined LPI state descriptor, acpi_lpit_native. > > Signed-off-by: Lenny Szubowicz Reviewed-by: Srinivas Pandruvada > --- > drivers/acpi/acpi_lpit.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c > index e43cb71b6972..8b170a07908a 100644 > --- a/drivers/acpi/acpi_lpit.c > +++ b/drivers/acpi/acpi_lpit.c > @@ -137,7 +137,7 @@ static void lpit_update_residency(struct > lpit_residency_info *info, > > static void lpit_process(u64 begin, u64 end) > { > - while (begin + sizeof(struct acpi_lpit_native) < end) { > + while (begin + sizeof(struct acpi_lpit_native) <= end) { > struct acpi_lpit_native *lpit_native = (struct > acpi_lpit_native *)begin; > > if (!lpit_native->header.type && !lpit_native- > >header.flags) { > @@ -156,7 +156,6 @@ static void lpit_process(u64 begin, u64 end) > void acpi_init_lpit(void) > { > acpi_status status; > - u64 lpit_begin; > struct acpi_table_lpit *lpit; > > status = acpi_get_table(ACPI_SIG_LPIT, 0, (struct > acpi_table_header **)&lpit); > @@ -164,6 +163,6 @@ void acpi_init_lpit(void) > if (ACPI_FAILURE(status)) > return; > > - lpit_begin = (u64)lpit + sizeof(*lpit); > - lpit_process(lpit_begin, lpit_begin + lpit->header.length); > + lpit_process((u64)lpit + sizeof(*lpit), > + (u64)lpit + lpit->header.length); > }