From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 340A6FA3728 for ; Wed, 16 Oct 2019 22:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1C02218DE for ; Wed, 16 Oct 2019 22:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263603; bh=7GqnbcH+r90nThr865WG1XKok01vq2QVJ4b1QhEQN5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ICXvsuKtKU21PnEnN34vMhRfMeddmSwm6hCn+tMz9rI7BLl2XGShHbwNq2hpd6E1e S0mZIfW2+di5Y9miFBTGWgyph9nBp73OmXBBz8I/Xixsj6FZxj1l525dRFwk5tQ66A dLWlLWkEBl08lf40u0CMrV6yry4K7IL0c0/UgUSo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406728AbfJPV60 (ORCPT ); Wed, 16 Oct 2019 17:58:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:50410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395490AbfJPV5g (ORCPT ); Wed, 16 Oct 2019 17:57:36 -0400 Received: from localhost (unknown [192.55.54.58]) (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 09BE421D7F; Wed, 16 Oct 2019 21:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263056; bh=7GqnbcH+r90nThr865WG1XKok01vq2QVJ4b1QhEQN5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awH4RzxIok22DVVp1t0MXqdhkXkftAlVjSkM5CQGMLjv8OmxITV0sCnaa7ku3Sd5a A0DKa8rcvz3+EeDrYNQIYecTQ+gyjx39zWFpz46lUFy+N3Yge8ASx7SNTwnwbolXuY 6k/ceNGO4cOxzEG1TAffWwq4JFv0riDVP3gCcgkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hung-Te Lin , Brian Norris , Stephen Boyd , Guenter Roeck , Sasha Levin Subject: [PATCH 4.19 58/81] firmware: google: increment VPD key_len properly Date: Wed, 16 Oct 2019 14:51:09 -0700 Message-Id: <20191016214843.336805131@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214805.727399379@linuxfoundation.org> References: <20191016214805.727399379@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Brian Norris [ Upstream commit 442f1e746e8187b9deb1590176f6b0ff19686b11 ] Commit 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") adds length checks, but the new vpd_decode_entry() function botched the logic -- it adds the key length twice, instead of adding the key and value lengths separately. On my local system, this means vpd.c's vpd_section_create_attribs() hits an error case after the first attribute it parses, since it's no longer looking at the correct offset. With this patch, I'm back to seeing all the correct attributes in /sys/firmware/vpd/... Fixes: 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") Cc: Cc: Hung-Te Lin Signed-off-by: Brian Norris Reviewed-by: Stephen Boyd Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20190930214522.240680-1-briannorris@chromium.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/firmware/google/vpd_decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/google/vpd_decode.c b/drivers/firmware/google/vpd_decode.c index e75abe9fa122c..6c7ab2ba85d2f 100644 --- a/drivers/firmware/google/vpd_decode.c +++ b/drivers/firmware/google/vpd_decode.c @@ -62,7 +62,7 @@ static int vpd_decode_entry(const u32 max_len, const u8 *input_buf, if (max_len - consumed < *entry_len) return VPD_FAIL; - consumed += decoded_len; + consumed += *entry_len; *_consumed = consumed; return VPD_OK; } -- 2.20.1