Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933816AbbBISwx (ORCPT ); Mon, 9 Feb 2015 13:52:53 -0500 Received: from mail-we0-f181.google.com ([74.125.82.181]:42919 "EHLO mail-we0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933546AbbBISwv (ORCPT ); Mon, 9 Feb 2015 13:52:51 -0500 MIME-Version: 1.0 In-Reply-To: References: <1423381030-3457-1-git-send-email-matwey@sai.msu.ru> From: "Matwey V. Kornilov" Date: Mon, 9 Feb 2015 22:52:30 +0400 X-Google-Sender-Auth: _6Ergz1PKxElzyMLtbYODHiD0ow Message-ID: Subject: Re: [PATCH] pci: spear: Drop __initdata from struct platform_driver spear13xx_pcie_driver To: Viresh Kumar Cc: Mohit Kumar , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4213 Lines: 63 2015-02-09 16:11 GMT+03:00 Matwey V. Kornilov : > 2015-02-09 7:22 GMT+03:00 Viresh Kumar : >> On Sun, Feb 8, 2015 at 3:37 PM, Matwey V. Kornilov wrote: >>> spear13xx_pcie_driver.driver is allocated in text.init section >>> and then the pointer to it is passed futher. This patch is to avoid >>> crashes like the following, when freed memory is used: >>> >>> #0 __device_attach (drv=0xc0ed5608 , data=0xdb622610) at ../drivers/base/dd.c:409 >>> #1 0xc07a4798 in bus_for_each_drv (bus=, start=, data=0xda0, fn=0xc07a6740 <__device_attach>) >>> at ../drivers/base/bus.c:463 >>> #2 0xc07a6324 in device_attach (dev=0xdb622610) at ../drivers/base/dd.c:447 >>> #3 0xc07a5814 in bus_probe_device (dev=0xdb622610) at ../drivers/base/bus.c:558 >>> #4 0xc07a38d8 in device_add (dev=) at ../drivers/base/core.c:1058 >>> #5 0xc08b6a5c in of_device_add (ofdev=) at ../drivers/of/device.c:66 >>> #6 0xc08b742c in of_platform_device_create_pdata (np=, bus_id=0x0 <__vectors_start>, platform_data=0x0 <__vectors_start>, >>> parent=) at ../drivers/of/platform.c:241 >>> #7 0xc08b7568 in of_platform_bus_create (bus=0xdfa46780, matches=0x0 <__vectors_start>, lookup=0x0 <__vectors_start>, parent=0xdb183410, >>> strict=true) at ../drivers/of/platform.c:414 >>> #8 0xc08b79bc in of_platform_populate (root=0xc0ed5608 , matches=0xdb622610, lookup=0xda0, >>> parent=0xc07a6740 <__device_attach>) at ../drivers/of/platform.c:501 >>> #9 0xbf000030 in am335x_child_probe (pdev=0xdb183400) at ../drivers/usb/musb/musb_am335x.c:12 >>> #10 0xc07a83f0 in platform_drv_probe (_dev=0xdb183410) at ../drivers/base/platform.c:512 >>> #11 0xc07a64e8 in really_probe (drv=, dev=) at ../drivers/base/dd.c:302 >>> #12 driver_probe_device (drv=0xbf000234, dev=0xdb183410) at ../drivers/base/dd.c:399 >>> #13 0xc07a6820 in __driver_attach (dev=0xdb183410, data=0xbf000234) at ../drivers/base/dd.c:477 >>> #14 0xc07a46e8 in bus_for_each_dev (bus=, start=, data=0xda0, fn=0xc07a83a4 ) >>> at ../drivers/base/bus.c:313 >>> #15 0xc07a5ebc in driver_attach (drv=) at ../drivers/base/dd.c:496 >>> #16 0xc07a5af0 in bus_add_driver (drv=0xbf000234) at ../drivers/base/bus.c:694 >>> #17 0xc07a6fec in driver_register (drv=0xbf000234) at ../drivers/base/driver.c:167 >>> #18 0xc0209c34 in do_one_initcall (fn=0xbf002000) at ../init/main.c:801 >>> #19 0xc02e0494 in do_init_module (mod=) at ../kernel/module.c:3142 >>> #20 load_module (info=0xdb6b1f54, uargs=, flags=) at ../kernel/module.c:3461 >>> #21 0xc02e0a44 in SYSC_finit_module (flags=, uargs=, fd=) at ../kernel/module.c:3537 >>> #22 SyS_finit_module (fd=7, uargs=-1225602132, flags=0) at ../kernel/module.c:3518 >>> #23 0xc021a680 in ?? () >>> >>> Fixes: 6675ef212da (PCI: spear: Fix Section mismatch compilation warning for probe()) >> >> wouldn't this again result in the problem reported above ? >> > > Frankly speaking, I don't believe that that problem ever existed. > probe() is marked as __init, it assumes that there are/were guarantees > that nobody will require actual probing after the driver init. This > way there is completely no difference where .probe points to. > If one wants just to make linker happy and not see warnings, almost > all __init specifications should be dropped out. > Ok, I think I can re-implement spear13xx_pcie_init in the way using platform_driver_probe instead of platform_driver_register and we will not see neither kernel OOPSes nor linker warnings. -- With best regards, Matwey V. Kornilov. Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/