1. 29 3月, 2012 3 次提交
  2. 24 1月, 2012 1 次提交
  3. 05 1月, 2012 1 次提交
    • N
      firmware: Fix an oops on reading fw_priv->fw in sysfs loading file · eea915bb
      Neil Horman 提交于
      This oops was reported recently:
      firmware_loading_store+0xf9/0x17b
      dev_attr_store+0x20/0x22
      sysfs_write_file+0x101/0x134
      vfs_write+0xac/0xf3
      sys_write+0x4a/0x6e
      system_call_fastpath+0x16/0x1b
      
      The complete backtrace was unfortunately not captured, but details can be found
      here:
      https://bugzilla.redhat.com/show_bug.cgi?id=769920
      
      The cause is fairly clear.
      
      Its caused by the fact that firmware_loading_store has a case 0 in its
      switch statement that reads and writes the fw_priv->fw poniter without the
      protection of the fw_lock mutex.  since there is a window between the time that
      _request_firmware sets fw_priv->fw to NULL and the time the corresponding sysfs
      file is unregistered, its possible for a user space application to race in, and
      write a zero to the loading file, causing a NULL dereference in
      firmware_loading_store.  Fix it by extending the protection of the fw_lock mutex
      to cover all of the firware_loading_store function.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eea915bb
  4. 10 12月, 2011 1 次提交
    • S
      PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled() · b298d289
      Srivatsa S. Bhat 提交于
      Commit a144c6a6 (PM: Print a warning if firmware is requested when tasks
      are frozen) introduced usermodehelper_is_disabled() to warn and exit
      immediately if firmware is requested when usermodehelpers are disabled.
      
      However, it is racy. Consider the following scenario, currently used in
      drivers/base/firmware_class.c:
      
      ...
      if (usermodehelper_is_disabled())
              goto out;
      
      /* Do actual work */
      ...
      
      out:
              return err;
      
      Nothing prevents someone from disabling usermodehelpers just after the check
      in the 'if' condition, which means that it is quite possible to try doing the
      "actual work" with usermodehelpers disabled, leading to undesirable
      consequences.
      
      In particular, this race condition in _request_firmware() causes task freezing
      failures whenever suspend/hibernation is in progress because, it wrongly waits
      to get the firmware/microcode image from userspace when actually the
      usermodehelpers are disabled or userspace has been frozen.
      Some of the example scenarios that cause freezing failures due to this race
      are those that depend on userspace via request_firmware(), such as x86
      microcode module initialization and microcode image reload.
      
      Previous discussions about this issue can be found at:
      http://thread.gmane.org/gmane.linux.kernel/1198291/focus=1200591
      
      This patch adds proper synchronization to fix this issue.
      
      It is to be noted that this patchset fixes the freezing failures but doesn't
      remove the warnings. IOW, it does not attempt to add explicit synchronization
      to x86 microcode driver to avoid requesting microcode image at inopportune
      moments. Because, the warnings were introduced to highlight such cases, in the
      first place. And we need not silence the warnings, since we take care of the
      *real* problem (freezing failure) and hence, after that, the warnings are
      pretty harmless anyway.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b298d289
  5. 25 8月, 2011 1 次提交
  6. 18 5月, 2011 1 次提交
  7. 04 2月, 2011 1 次提交
  8. 24 8月, 2010 1 次提交
  9. 06 8月, 2010 2 次提交
  10. 22 5月, 2010 7 次提交
  11. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  12. 19 3月, 2010 2 次提交
    • R
      driver-core: fix missing kernel-doc in firmware_class · e59817bf
      Randy Dunlap 提交于
      Fix kernel-doc warning in firmware_class.c:
      
      Warning(drivers/base/firmware_class.c:94): No description found for parameter 'attr'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e59817bf
    • J
      sysfs: use sysfs_bin_attr_init in firmware class driver · e1955ca0
      Jiri Kosina 提交于
      Annotate dynamic sysfs attribute in fw_setup_device(). This gets
      rid of the following lockdep warning:
      
      bnx2 0000:08:00.0: firmware: requesting bnx2/bnx2-mips-06-5.0.0.j6.fw
      BUG: key ffff880008293470 not in .data!
      ------------[ cut here ]------------
      WARNING: at kernel/lockdep.c:2706 lockdep_init_map+0x562/0x620()
      Modules linked in: bnx2(+) sg tpm_bios floppy rtc_lib usb_storage i2c_piix4 joydev button container shpchp i2c_core sr_mod cdrom pci_hotplug usbhid hid ohci_hcd ehci_hcd sd_mod usbcore edd ext3 mbcache jbd fan ata_generic sata_svw pata_serverworks libata scsi_mod thermal processor
      Pid: 1915, comm: work_for_cpu Not tainted 2.6.34-rc1-default #81
      Call Trace:
       [<ffffffff8107c1d2>] ? lockdep_init_map+0x562/0x620
       [<ffffffff81049fd8>] warn_slowpath_common+0x78/0xd0
       [<ffffffff8104a03f>] warn_slowpath_null+0xf/0x20
       [<ffffffff8107c1d2>] lockdep_init_map+0x562/0x620
       [<ffffffff8117a236>] ? sysfs_new_dirent+0x76/0x120
       [<ffffffff8126edb2>] ? put_device+0x12/0x20
       [<ffffffff811797cc>] sysfs_add_file_mode+0x6c/0xd0
       [<ffffffff8117983c>] sysfs_add_file+0xc/0x10
       [<ffffffff8117bf61>] sysfs_create_bin_file+0x21/0x30
       [<ffffffff81279c61>] _request_firmware+0x2f1/0x650
       [<ffffffff8127a04e>] request_firmware+0xe/0x10
       [<ffffffffa01ec19e>] bnx2_init_one+0x8f5/0x177e [bnx2]
       [<ffffffff81389eab>] ? _raw_spin_unlock_irq+0x2b/0x40
       [<ffffffff81040ed9>] ? finish_task_switch+0x69/0x100
       [<ffffffff81040e70>] ? finish_task_switch+0x0/0x100
       [<ffffffff81064b40>] ? do_work_for_cpu+0x0/0x30
       [<ffffffff811e6302>] local_pci_probe+0x12/0x20
       [<ffffffff81064b53>] do_work_for_cpu+0x13/0x30
       [<ffffffff81064b40>] ? do_work_for_cpu+0x0/0x30
       [<ffffffff81068c56>] kthread+0x96/0xa0
       [<ffffffff81003e64>] kernel_thread_helper+0x4/0x10
       [<ffffffff8138a350>] ? restore_args+0x0/0x30
       [<ffffffff81068bc0>] ? kthread+0x0/0xa0
       [<ffffffff81003e60>] ? kernel_thread_helper+0x0/0x10
      ---[ end trace a2ecee9c9602d195 ]---
      
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      e1955ca0
  13. 08 3月, 2010 3 次提交
  14. 12 12月, 2009 1 次提交
    • J
      firmware_class: make request_firmware_nowait more useful · 9ebfbd45
      Johannes Berg 提交于
      Unfortunately, one cannot hold on to the struct firmware
      that request_firmware_nowait() hands off, which is needed
      in some cases. Allow this by requiring the callback to
      free it (via release_firmware).
      
      Additionally, give it a gfp_t parameter -- all the current
      users call it from a GFP_KERNEL context so the GFP_ATOMIC
      isn't necessary. This also marks an API break which is
      useful in a sense, although that is obviously not the
      primary purpose of this change.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: David Woodhouse <David.Woodhouse@intel.com>
      Cc: Pavel Roskin <proski@gnu.org>
      Cc: Abhay Salunke <abhay_salunke@dell.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9ebfbd45
  15. 29 7月, 2009 1 次提交
  16. 13 7月, 2009 1 次提交
  17. 09 7月, 2009 1 次提交
  18. 16 6月, 2009 4 次提交
  19. 15 5月, 2009 1 次提交
    • D
      firmware: speed up request_firmware(), v3 · 6e03a201
      David Woodhouse 提交于
      Rather than calling vmalloc() repeatedly to grow the firmware image as
      we receive data from userspace, just allocate and fill individual pages.
      Then vmap() the whole lot in one go when we're done.
      
      A quick test with a 337KiB iwlagn firmware shows the time taken for
      request_firmware() going from ~32ms to ~5ms after I apply this patch.
      
      [v2: define PAGE_KERNEL_RO as PAGE_KERNEL where necessary, use min_t()]
      [v3: kunmap() takes the struct page *, not the virtual address]
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Tested-by: NSachin Sant <sachinp@in.ibm.com>
      6e03a201
  20. 25 3月, 2009 1 次提交
    • M
      Driver core: implement uevent suppress in kobject · f67f129e
      Ming Lei 提交于
      This patch implements uevent suppress in kobject and removes it
      from struct device, based on the following ideas:
      
      1,Uevent sending should be one attribute of kobject, so suppressing it
      in kobject layer is more natural than in device layer. By this way,
      we can do it for other objects embedded with kobject.
      
      2,It may save several bytes for each instance of struct device.(On my
      omap3(32bit ARM) based box, can save 8bytes per device object)
      
      This patch also introduces dev_set|get_uevent_suppress() helpers to
      set and query uevent_suppress attribute in case to help kobject
      as private part of struct device in future.
      
      [This version is against the latest driver-core patch set of Greg,please
      ignore the last version.]
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f67f129e
  21. 07 1月, 2009 1 次提交
  22. 17 10月, 2008 1 次提交
  23. 26 7月, 2008 1 次提交
  24. 10 7月, 2008 2 次提交
    • D
      firmware: allow firmware files to be built into kernel image · 5658c769
      David Woodhouse 提交于
      Some drivers have their own hacks to bypass the kernel's firmware loader
      and build their firmware into the kernel; this renders those unnecessary.
      
      Other drivers don't use the firmware loader at all, because they always
      want the firmware to be available. This allows them to start using the
      firmware loader.
      
      A third set of drivers already use the firmware loader, but can't be
      used without help from userspace, which sometimes requires an initrd.
      This allows them to work in a static kernel.
      Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
      5658c769
    • D
      firmware: make fw->data const · b7a39bd0
      David Woodhouse 提交于
      In preparation for supporting firmware files linked into the static
      kernel, make fw->data const to ensure that users aren't modifying it (so
      that we can pass a pointer to the original in-kernel copy, rather than
      having to copy it).
      Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
      b7a39bd0