Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1343150ybp; Thu, 17 Oct 2019 11:20:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyhEPR0D1ko5mQmKFJXrjjStn6Z/O+li/+7ZXzFhAz2NiBb9dDKiqPnivSSEyH1GJk6AbZ X-Received: by 2002:a50:e606:: with SMTP id y6mr5214060edm.261.1571336425924; Thu, 17 Oct 2019 11:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336425; cv=none; d=google.com; s=arc-20160816; b=c26GqUtc4h29346ZvdvJq1ZGxkDHJ9QMc7m0LxuW0czvsryk/b0tbm6z9RicXZQpY6 hjerwQ/GHWDMnsOeWm9qhfyMRA4ePFXuRfXlgrtdHVAo0x6Dh3hXYldIGhw5Hkmql5bl y/EyNyndGg/1h3CYOq44ID0XYnxEp5aopWH2xBwxmjEyQ4SQSc8keZ9KIvLDY+iWg9vG O5qcmalMnn1tDzHVMY72V/SHniMunZu2ytm3OEhqmooNf1LKDoi4jwnioUtkLv3d8wCb Gmfolm05JIK3G1nSyjt8YH/6x9juepil02PLDSbF3GH4OTLHrQkU72bYild/6dZWPfi4 LujA== 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=HxJ2m5xYcLCGKiMpy5tO0k166UzxTCA8R4qQ5G7im5Y=; b=wu42nYxnbiHGXZ3WhjqP+OU6GFB97UUjMzDy/b7hULGVlaePvng+ldfZpyfQzkVuzF 7MpH32GVpkK/oJWxZ3Vx4tMHr+CmZtGhctb/kFlrE4HdfWY9T2unuBVzcGDJOxmK/E2b VQ5xXbMcaXnfzCAJSB5vpm3NjSNy/l34TqByqj+683bYo2b5zICgB9qRC0FDKvODqI9G h1yqCmpBRN8m2OBlDchHohPlZ5U/A3DcpAWgz3xUY0vh4d3OCUpvr6/Sf9U1CLH5KsS1 d0WAEJwUQXVWO1hprV13Dw+ly6DvnIdOxP6o3zPp/dJ/oxXj0ytrSO2FylL9pQIcu03F afSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="SW/BUHmM"; 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 f13si2196587eda.277.2019.10.17.11.20.03; Thu, 17 Oct 2019 11:20:25 -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="SW/BUHmM"; 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 S2438750AbfJPWAW (ORCPT + 99 others); Wed, 16 Oct 2019 18:00:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:53714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438427AbfJPV7N (ORCPT ); Wed, 16 Oct 2019 17:59:13 -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 5D35E21D7F; Wed, 16 Oct 2019 21:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263152; bh=eBXi4eUco+qCfMawbbaI//iav+3ieFt2vwWQoS4XPDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SW/BUHmMXbEZ6caxMy3hzShb1myZjHdNirgVL3j3TRbAoTXvA5Zwh8EChhejGA8T0 xMWpPH/dO5GAKmDzWazZXhWd99cMmPVq7JSTCy55Bontr84G9r3OJYCKVnOTK+6JVh 3n5+Og4fAlavpd6/C5m8l2NTnSvbSXRA3hLS53/M= 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 5.3 080/112] firmware: google: increment VPD key_len properly Date: Wed, 16 Oct 2019 14:51:12 -0700 Message-Id: <20191016214904.524571232@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@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 dda525c0f9682..5c6f2a74f1049 100644 --- a/drivers/firmware/google/vpd_decode.c +++ b/drivers/firmware/google/vpd_decode.c @@ -52,7 +52,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