linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: google: increment VPD key_len properly
@ 2019-09-30 21:45 Brian Norris
  2019-09-30 22:04 ` Brian Norris
  2019-09-30 22:26 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Brian Norris @ 2019-09-30 21:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Stephen Boyd, Guenter Roeck, Hung-Te Lin,
	Brian Norris, stable, Guenter Roeck

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: <stable@vger.kernel.org>
Cc: Hung-Te Lin <hungte@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 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 dda525c0f968..5c6f2a74f104 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.23.0.444.g18eeb5a265-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] firmware: google: increment VPD key_len properly
  2019-09-30 21:45 [PATCH] firmware: google: increment VPD key_len properly Brian Norris
@ 2019-09-30 22:04 ` Brian Norris
  2019-09-30 22:26 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2019-09-30 22:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linux Kernel, Stephen Boyd, Guenter Roeck, Hung-Te Lin, stable,
	Guenter Roeck

On Mon, Sep 30, 2019 at 2:45 PM Brian Norris <briannorris@chromium.org> wrote:
> Fixes: 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data")
> Cc: <stable@vger.kernel.org>

Perhaps I should have modified the subject to note the urgency (e.g.,
[PATCH 5.4]). The above regression was recently shipped to v4.14.146
and v4.19.75.

Brian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] firmware: google: increment VPD key_len properly
  2019-09-30 21:45 [PATCH] firmware: google: increment VPD key_len properly Brian Norris
  2019-09-30 22:04 ` Brian Norris
@ 2019-09-30 22:26 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2019-09-30 22:26 UTC (permalink / raw)
  To: Brian Norris, Greg Kroah-Hartman
  Cc: linux-kernel, Guenter Roeck, Hung-Te Lin, Brian Norris, stable,
	Guenter Roeck

Quoting Brian Norris (2019-09-30 14:45:22)
> 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: <stable@vger.kernel.org>
> Cc: Hung-Te Lin <hungte@chromium.org>
> Cc: Guenter Roeck <groeck@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-30 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 21:45 [PATCH] firmware: google: increment VPD key_len properly Brian Norris
2019-09-30 22:04 ` Brian Norris
2019-09-30 22:26 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).