]> www.infradead.org Git - users/jedix/linux-maple.git/commit
efi: Fix out-of-bounds read in variable_matches()
authorLaszlo Ersek <lersek@redhat.com>
Fri, 2 Dec 2016 22:18:05 +0000 (14:18 -0800)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:21:52 +0000 (17:21 -0500)
commit767ea6dc810e900a61030a673c906131500622ec
treeeaec9e099ed28ed69905da30981dfd5daab08f32
parente1684ef0e6bc9edbaea75cb2d041990c3733a02e
efi: Fix out-of-bounds read in variable_matches()

Orabug: 25227159

[ Upstream commit 630ba0cc7a6dbafbdee43795617c872b35cde1b4 ]

The variable_matches() function can currently read "var_name[len]", for
example when:

 - var_name[0] == 'a',
 - len == 1
 - match_name points to the NUL-terminated string "ab".

This function is supposed to accept "var_name" inputs that are not
NUL-terminated (hence the "len" parameter"). Document the function, and
access "var_name[*match]" only if "*match" is smaller than "len".

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Matthew Garrett <mjg59@coreos.com>
Cc: Jason Andryuk <jandryuk@gmail.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: <stable@vger.kernel.org> # v3.10+
Link: http://thread.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/86906
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 83619523130164cb525e35b6001755cd185055fb)

Conflicts:

drivers/firmware/efi/vars.c

Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/firmware/efi/vars.c