From: Matt Fleming <matt@codeblueprint.co.uk>
To: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>
Cc: Wang YanQing <udknight@gmail.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
Matt Fleming <matt@codeblueprint.co.uk>,
David Herrmann <dh.herrmann@gmail.com>,
Peter Jones <pjones@redhat.com>,
stable@vger.kernel.org, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 2/3] x86/sysfb_efi: Fix valid BAR address range check
Date: Tue, 3 May 2016 20:29:40 +0100 [thread overview]
Message-ID: <1462303781-8686-3-git-send-email-matt@codeblueprint.co.uk> (raw)
In-Reply-To: <1462303781-8686-1-git-send-email-matt@codeblueprint.co.uk>
From: Wang YanQing <udknight@gmail.com>
We can't just break out when meet start is equal to zero,
this will cause us to miss valid address ranges in later BARs.
On the other hand, it isn't enough to test start only
for below situation:
0(start) <= lfb_base < end
Due to the BUG this patch fix, I can't use video=efifb:
boot parameter to get efifb on my new ThinkPad E550 for
my old linux system hard disk with 3.10 kernel. In 3.10,
efifb is the only choice due to DRM/I915 in it doesn't
support the GPU.
This patch also add a trivial optimization, break out
after we find the address range is valid without test
later BARs.
Signed-off-by: Wang YanQing <udknight@gmail.com>
Reviewed-by: Peter Jones <pjones@redhat.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <stable@vger.kernel.org>
[ Updated changelog ]
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
arch/x86/kernel/sysfb_efi.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c
index b285d4e8c68e..5da924bbf0a0 100644
--- a/arch/x86/kernel/sysfb_efi.c
+++ b/arch/x86/kernel/sysfb_efi.c
@@ -106,14 +106,24 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
continue;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
resource_size_t start, end;
+ unsigned long flags;
+
+ flags = pci_resource_flags(dev, i);
+ if (!(flags & IORESOURCE_MEM))
+ continue;
+
+ if (flags & IORESOURCE_UNSET)
+ continue;
+
+ if (pci_resource_len(dev, i) == 0)
+ continue;
start = pci_resource_start(dev, i);
- if (start == 0)
- break;
end = pci_resource_end(dev, i);
if (screen_info.lfb_base >= start &&
screen_info.lfb_base < end) {
found_bar = 1;
+ break;
}
}
}
--
2.7.3
next prev parent reply other threads:[~2016-05-03 19:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 19:29 [GIT PULL 0/3] EFI urgent fixes Matt Fleming
[not found] ` <1462303781-8686-1-git-send-email-matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-05-03 19:29 ` [PATCH 1/3] MAINTAINERS: Remove asterisk from EFI directory names Matt Fleming
2016-05-03 19:29 ` Matt Fleming [this message]
2016-05-04 6:35 ` [PATCH 2/3] x86/sysfb_efi: Fix valid BAR address range check Ingo Molnar
2016-05-04 9:25 ` Matt Fleming
2016-05-04 10:23 ` Ingo Molnar
[not found] ` <20160504102340.GA4470-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-04 10:29 ` Matt Fleming
[not found] ` <20160504063524.GB12846-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-04 15:43 ` Wang YanQing
2016-05-03 19:29 ` [PATCH 3/3] x86/efi-bgrt: Switch all pr_err() to pr_notice() for invalid BGRT Matt Fleming
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=1462303781-8686-3-git-send-email-matt@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=ard.biesheuvel@linaro.org \
--cc=dh.herrmann@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pjones@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tomi.valkeinen@ti.com \
--cc=udknight@gmail.com \
/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).