From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Matt Fleming <matt@codeblueprint.co.uk>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [GIT PULL] EFI fix
Date: Thu, 28 Apr 2016 19:48:43 +0200 [thread overview]
Message-ID: <20160428174843.GA9923@gmail.com> (raw)
Linus,
Please pull the latest efi-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-for-linus
# HEAD: ede85e90be26e5de2a72f76feec01cfc5281d4bd Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into efi/urgent
This fixes a bug in the efivars code.
Thanks,
Ingo
------------------>
Laszlo Ersek (1):
efi: Fix out-of-bounds read in variable_matches()
drivers/firmware/efi/vars.c | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 0ac594c0a234..34b741940494 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -202,29 +202,44 @@ static const struct variable_validate variable_validate[] = {
{ NULL_GUID, "", NULL },
};
+/*
+ * Check if @var_name matches the pattern given in @match_name.
+ *
+ * @var_name: an array of @len non-NUL characters.
+ * @match_name: a NUL-terminated pattern string, optionally ending in "*". A
+ * final "*" character matches any trailing characters @var_name,
+ * including the case when there are none left in @var_name.
+ * @match: on output, the number of non-wildcard characters in @match_name
+ * that @var_name matches, regardless of the return value.
+ * @return: whether @var_name fully matches @match_name.
+ */
static bool
variable_matches(const char *var_name, size_t len, const char *match_name,
int *match)
{
for (*match = 0; ; (*match)++) {
char c = match_name[*match];
- char u = var_name[*match];
- /* Wildcard in the matching name means we've matched */
- if (c == '*')
+ switch (c) {
+ case '*':
+ /* Wildcard in @match_name means we've matched. */
return true;
- /* Case sensitive match */
- if (!c && *match == len)
- return true;
+ case '\0':
+ /* @match_name has ended. Has @var_name too? */
+ return (*match == len);
- if (c != u)
+ default:
+ /*
+ * We've reached a non-wildcard char in @match_name.
+ * Continue only if there's an identical character in
+ * @var_name.
+ */
+ if (*match < len && c == var_name[*match])
+ continue;
return false;
-
- if (!c)
- return true;
+ }
}
- return true;
}
bool
next reply other threads:[~2016-04-28 17:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-28 17:48 Ingo Molnar [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-05-18 9:17 [GIT PULL] EFI fix Ingo Molnar
2019-05-19 17:45 ` pr-tracker-bot
2019-01-11 7:46 Ingo Molnar
2019-01-11 14:22 ` Ard Biesheuvel
2019-01-11 17:55 ` Linus Torvalds
2019-01-12 8:53 ` Ingo Molnar
2019-01-11 17:47 ` Linus Torvalds
2019-01-12 8:54 ` Ingo Molnar
2018-11-30 6:21 Ingo Molnar
2018-11-30 21:00 ` pr-tracker-bot
2018-07-30 17:44 Ingo Molnar
2018-07-13 19:57 Ingo Molnar
2017-06-10 8:31 Ingo Molnar
2016-05-16 14:46 Ingo Molnar
2016-05-16 20:05 ` Linus Torvalds
2016-05-16 20:23 ` Alex Thorlton
2016-05-16 22:40 ` Alex Thorlton
2016-05-17 9:04 ` Matt Fleming
2016-05-17 9:46 ` Matt Fleming
2016-05-17 10:20 ` Ingo Molnar
2016-05-23 12:08 ` Matt Fleming
2016-05-23 12:33 ` Josh Poimboeuf
2016-05-24 9:03 ` Ingo Molnar
2016-04-16 9:08 Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160428174843.GA9923@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).