Re: [PATCH v3] x86: don't assume all fb devices are PCI devices
From: Ingo Molnar
Date: Tue Mar 15 2016 - 06:10:03 EST
* Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> wrote:
> When booting Hyper-V Generation 2 guests KASAN reports the following
> out-of-bounds access:
>
> BUG: KASAN: slab-out-of-bounds in fb_is_primary_device+0x58/0x70 at addr
> ffff880079cf0eb0
> Read of size 8 by task swapper/0/1
> ...
> [<ffffffff81581308>] dump_stack+0x63/0x8b
> [<ffffffff812e1f99>] print_trailer+0xf9/0x150
> [<ffffffff812e7344>] object_err+0x34/0x40
> [<ffffffff812e9630>] kasan_report_error+0x230/0x550
> [<ffffffff812e9ee8>] kasan_report+0x58/0x60
> [<ffffffff812e4500>] ? ___slab_alloc+0x80/0x490
> [<ffffffff81878a28>] ? fb_is_primary_device+0x58/0x70
> [<ffffffff812e87cd>] __asan_load8+0x5d/0x70
> [<ffffffff81878a28>] fb_is_primary_device+0x58/0x70
> [<ffffffff8162357a>] register_framebuffer+0xda/0x5b0
> [<ffffffff816234a0>] ? remove_conflicting_framebuffers+0x50/0x50
> ...
>
> The issue is caused by the to_pci_dev() call with no check that the given
> info->device is in fact a pci device and some fb devices (Hyper-V FB, EFI
> FB,...) are not. While on it, cleanup the function.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> ---
> Changes since v2: cleanup fb_is_primary_device() [Bjorn Helgaas, Ingo Molnar].
Applied, thanks!
I also added Bjorn's Acked-by to the commit, as the only change from the last
version are the cleanups.
Thanks,
Ingo