From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934609AbcCOKJ7 (ORCPT ); Tue, 15 Mar 2016 06:09:59 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34860 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932247AbcCOKJv (ORCPT ); Tue, 15 Mar 2016 06:09:51 -0400 Date: Tue, 15 Mar 2016 11:09:46 +0100 From: Ingo Molnar To: Vitaly Kuznetsov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Cathy Avery , "K. Y. Srinivasan" , Bjorn Helgaas Subject: Re: [PATCH v3] x86: don't assume all fb devices are PCI devices Message-ID: <20160315100946.GA20587@gmail.com> References: <1458030033-10122-1-git-send-email-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458030033-10122-1-git-send-email-vkuznets@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Vitaly Kuznetsov 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 > ... > [] dump_stack+0x63/0x8b > [] print_trailer+0xf9/0x150 > [] object_err+0x34/0x40 > [] kasan_report_error+0x230/0x550 > [] kasan_report+0x58/0x60 > [] ? ___slab_alloc+0x80/0x490 > [] ? fb_is_primary_device+0x58/0x70 > [] __asan_load8+0x5d/0x70 > [] fb_is_primary_device+0x58/0x70 > [] register_framebuffer+0xda/0x5b0 > [] ? 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 > --- > 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