1. 16 4月, 2013 3 次提交
    • M
      efi: Distinguish between "remaining space" and actually used space · 31ff2f20
      Matthew Garrett 提交于
      EFI implementations distinguish between space that is actively used by a
      variable and space that merely hasn't been garbage collected yet. Space
      that hasn't yet been garbage collected isn't available for use and so isn't
      counted in the remaining_space field returned by QueryVariableInfo().
      
      Combined with commit 68d92986 this can cause problems. Some implementations
      don't garbage collect until the remaining space is smaller than the maximum
      variable size, and as a result check_var_size() will always fail once more
      than 50% of the variable store has been used even if most of that space is
      marked as available for garbage collection. The user is unable to create
      new variables, and deleting variables doesn't increase the remaining space.
      
      The problem that 68d92986 was attempting to avoid was one where certain
      platforms fail if the actively used space is greater than 50% of the
      available storage space. We should be able to calculate that by simply
      summing the size of each available variable and subtracting that from
      the total storage space. With luck this will fix the problem described in
      https://bugzilla.kernel.org/show_bug.cgi?id=55471 without permitting
      damage to occur to the machines 68d92986 was attempting to fix.
      Signed-off-by: NMatthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      31ff2f20
    • M
      efi: Pass boot services variable info to runtime code · cc5a080c
      Matthew Garrett 提交于
      EFI variables can be flagged as being accessible only within boot services.
      This makes it awkward for us to figure out how much space they use at
      runtime. In theory we could figure this out by simply comparing the results
      from QueryVariableInfo() to the space used by all of our variables, but
      that fails if the platform doesn't garbage collect on every boot. Thankfully,
      calling QueryVariableInfo() while still inside boot services gives a more
      reliable answer. This patch passes that information from the EFI boot stub
      up to the efi platform code.
      Signed-off-by: NMatthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      cc5a080c
    • M
      Move utf16 functions to kernel core and rename · 0635eb8a
      Matthew Garrett 提交于
      We want to be able to use the utf16 functions that are currently present
      in the EFI variables code in platform-specific code as well. Move them to
      the kernel core, and in the process rename them to accurately describe what
      they do - they don't handle UTF16, only UCS2.
      Signed-off-by: NMatthew Garrett <matthew.garrett@nebula.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      0635eb8a
  2. 11 4月, 2013 1 次提交
  3. 09 4月, 2013 1 次提交
    • M
      x86, efivars: firmware bug workarounds should be in platform code · a6e4d5a0
      Matt Fleming 提交于
      Let's not burden ia64 with checks in the common efivars code that we're not
      writing too much data to the variable store. That kind of thing is an x86
      firmware bug, plain and simple.
      
      efi_query_variable_store() provides platforms with a wrapper in which they can
      perform checks and workarounds for EFI variable storage bugs.
      
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      a6e4d5a0
  4. 23 3月, 2013 1 次提交
  5. 21 3月, 2013 4 次提交
    • M
      efivars: Handle duplicate names from get_next_variable() · e971318b
      Matt Fleming 提交于
      Some firmware exhibits a bug where the same VariableName and
      VendorGuid values are returned on multiple invocations of
      GetNextVariableName(). See,
      
          https://bugzilla.kernel.org/show_bug.cgi?id=47631
      
      As a consequence of such a bug, Andre reports hitting the following
      WARN_ON() in the sysfs code after updating the BIOS on his, "Gigabyte
      Technology Co., Ltd. To be filled by O.E.M./Z77X-UD3H, BIOS F19e
      11/21/2012)" machine,
      
      [    0.581554] EFI Variables Facility v0.08 2004-May-17
      [    0.584914] ------------[ cut here ]------------
      [    0.585639] WARNING: at /home/andre/linux/fs/sysfs/dir.c:536 sysfs_add_one+0xd4/0x100()
      [    0.586381] Hardware name: To be filled by O.E.M.
      [    0.587123] sysfs: cannot create duplicate filename '/firmware/efi/vars/SbAslBufferPtrVar-01f33c25-764d-43ea-aeea-6b5a41f3f3e8'
      [    0.588694] Modules linked in:
      [    0.589484] Pid: 1, comm: swapper/0 Not tainted 3.8.0+ #7
      [    0.590280] Call Trace:
      [    0.591066]  [<ffffffff81208954>] ? sysfs_add_one+0xd4/0x100
      [    0.591861]  [<ffffffff810587bf>] warn_slowpath_common+0x7f/0xc0
      [    0.592650]  [<ffffffff810588bc>] warn_slowpath_fmt+0x4c/0x50
      [    0.593429]  [<ffffffff8134dd85>] ? strlcat+0x65/0x80
      [    0.594203]  [<ffffffff81208954>] sysfs_add_one+0xd4/0x100
      [    0.594979]  [<ffffffff81208b78>] create_dir+0x78/0xd0
      [    0.595753]  [<ffffffff81208ec6>] sysfs_create_dir+0x86/0xe0
      [    0.596532]  [<ffffffff81347e4c>] kobject_add_internal+0x9c/0x220
      [    0.597310]  [<ffffffff81348307>] kobject_init_and_add+0x67/0x90
      [    0.598083]  [<ffffffff81584a71>] ? efivar_create_sysfs_entry+0x61/0x1c0
      [    0.598859]  [<ffffffff81584b2b>] efivar_create_sysfs_entry+0x11b/0x1c0
      [    0.599631]  [<ffffffff8158517e>] register_efivars+0xde/0x420
      [    0.600395]  [<ffffffff81d430a7>] ? edd_init+0x2f5/0x2f5
      [    0.601150]  [<ffffffff81d4315f>] efivars_init+0xb8/0x104
      [    0.601903]  [<ffffffff8100215a>] do_one_initcall+0x12a/0x180
      [    0.602659]  [<ffffffff81d05d80>] kernel_init_freeable+0x13e/0x1c6
      [    0.603418]  [<ffffffff81d05586>] ? loglevel+0x31/0x31
      [    0.604183]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
      [    0.604936]  [<ffffffff816a653e>] kernel_init+0xe/0xf0
      [    0.605681]  [<ffffffff816ce7ec>] ret_from_fork+0x7c/0xb0
      [    0.606414]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
      [    0.607143] ---[ end trace 1609741ab737eb29 ]---
      
      There's not much we can do to work around and keep traversing the
      variable list once we hit this firmware bug. Our only solution is to
      terminate the loop because, as Lingzhu reports, some machines get
      stuck when they encounter duplicate names,
      
        > I had an IBM System x3100 M4 and x3850 X5 on which kernel would
        > get stuck in infinite loop creating duplicate sysfs files because,
        > for some reason, there are several duplicate boot entries in nvram
        > getting GetNextVariableName into a circle of iteration (with
        > period > 2).
      
      Also disable the workqueue, as efivar_update_sysfs_entries() uses
      GetNextVariableName() to figure out which variables have been created
      since the last iteration. That algorithm isn't going to work if
      GetNextVariableName() returns duplicates. Note that we don't disable
      EFI variable creation completely on the affected machines, it's just
      that any pstore dump-* files won't appear in sysfs until the next
      boot.
      Reported-by: NAndre Heider <a.heider@gmail.com>
      Reported-by: NLingzhu Xiang <lxiang@redhat.com>
      Tested-by: NLingzhu Xiang <lxiang@redhat.com>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      e971318b
    • M
      efivars: explicitly calculate length of VariableName · ec50bd32
      Matt Fleming 提交于
      It's not wise to assume VariableNameSize represents the length of
      VariableName, as not all firmware updates VariableNameSize in the same
      way (some don't update it at all if EFI_SUCCESS is returned). There
      are even implementations out there that update VariableNameSize with
      values that are both larger than the string returned in VariableName
      and smaller than the buffer passed to GetNextVariableName(), which
      resulted in the following bug report from Michael Schroeder,
      
        > On HP z220 system (firmware version 1.54), some EFI variables are
        > incorrectly named :
        >
        > ls -d /sys/firmware/efi/vars/*8be4d* | grep -v -- -8be returns
        > /sys/firmware/efi/vars/dbxDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
        > /sys/firmware/efi/vars/KEKDefault-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
        > /sys/firmware/efi/vars/SecureBoot-pport8be4df61-93ca-11d2-aa0d-00e098032b8c
        > /sys/firmware/efi/vars/SetupMode-Information8be4df61-93ca-11d2-aa0d-00e098032b8c
      
      The issue here is that because we blindly use VariableNameSize without
      verifying its value, we can potentially read garbage values from the
      buffer containing VariableName if VariableNameSize is larger than the
      length of VariableName.
      
      Since VariableName is a string, we can calculate its size by searching
      for the terminating NULL character.
      Reported-by: NFrederic Crozat <fcrozat@suse.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Josh Boyer <jwboyer@redhat.com>
      Cc: Michael Schroeder <mls@suse.com>
      Cc: Lee, Chun-Yi <jlee@suse.com>
      Cc: Lingzhu Xiang <lxiang@redhat.com>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      ec50bd32
    • S
      efivars: Add module parameter to disable use as a pstore backend · ec0971ba
      Seth Forshee 提交于
      We know that with some firmware implementations writing too much data to
      UEFI variables can lead to bricking machines. Recent changes attempt to
      address this issue, but for some it may still be prudent to avoid
      writing large amounts of data until the solution has been proven on a
      wide variety of hardware.
      
      Crash dumps or other data from pstore can potentially be a large data
      source. Add a pstore_module parameter to efivars to allow disabling its
      use as a backend for pstore. Also add a config option,
      CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE, to allow setting the default
      value of this paramter to true (i.e. disabled by default).
      Signed-off-by: NSeth Forshee <seth.forshee@canonical.com>
      Cc: Josh Boyer <jwboyer@redhat.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      ec0971ba
    • S
      efivars: Allow disabling use as a pstore backend · ed9dc8ce
      Seth Forshee 提交于
      Add a new option, CONFIG_EFI_VARS_PSTORE, which can be set to N to
      avoid using efivars as a backend to pstore, as some users may want to
      compile out the code completely.
      
      Set the default to Y to maintain backwards compatability, since this
      feature has always been enabled until now.
      Signed-off-by: NSeth Forshee <seth.forshee@canonical.com>
      Cc: Josh Boyer <jwboyer@redhat.com>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Seiji Aguchi <seiji.aguchi@hds.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      ed9dc8ce
  6. 11 3月, 2013 1 次提交
  7. 10 3月, 2013 2 次提交
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace · 72932611
      Linus Torvalds 提交于
      Pull namespace bugfixes from Eric Biederman:
       "This is three simple fixes against 3.9-rc1.  I have tested each of
        these fixes and verified they work correctly.
      
        The userns oops in key_change_session_keyring and the BUG_ON triggered
        by proc_ns_follow_link were found by Dave Jones.
      
        I am including the enhancement for mount to only trigger requests of
        filesystem modules here instead of delaying this for the 3.10 merge
        window because it is both trivial and the kind of change that tends to
        bit-rot if left untouched for two months."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
        proc: Use nd_jump_link in proc_ns_follow_link
        fs: Limit sys_mount to only request filesystem modules (Part 2).
        fs: Limit sys_mount to only request filesystem modules.
        userns: Stop oopsing in key_change_session_keyring
      72932611
    • L
      Atmel MXT touchscreen: increase reset timeouts · 8343bce1
      Linus Torvalds 提交于
      There is a more complete atmel patch-series out by Nick Dyer that fixes
      this and other things, but in the meantime this is the minimal thing to
      get the touchscreen going on (at least my) Pixel Chromebook.
      
      Not that I want my dirty fingers near that beautiful screen, but it
      seems that a non-initialized touchscreen will also end up being a
      constant wakeup source, so you have to disable it to go to sleep.  And
      it's easier to just fix the initialization sequence.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8343bce1
  8. 09 3月, 2013 23 次提交
  9. 08 3月, 2013 4 次提交
    • L
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 47b3bc90
      Linus Torvalds 提交于
      Pull x86 fixes from Peter Anvin:
       "Several boot fixes (MacBook, legacy EFI bootloaders), another
        please-don't-brick fix, and some minor stuff."
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86: Do not try to sync identity map for non-mapped pages
        x86, doc: Be explicit about what the x86 struct boot_params requires
        x86: Don't clear efi_info even if the sentinel hits
        x86, mm: Make sure to find a 2M free block for the first mapped area
        x86: Fix 32-bit *_cpu_data initializers
        efivarfs: return accurate error code in efivarfs_fill_super()
        efivars: efivarfs_valid_name() should handle pstore syntax
        efi: be more paranoid about available space when creating variables
        iommu, x86: Add DMA remap fault reason
        x86, smpboot: Remove unused variable
      47b3bc90
    • L
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · af2841cd
      Linus Torvalds 提交于
      Pull drm fixes from Dave Airlie:
       "Misc radeon, nouveau, mgag200 and intel fixes.
      
        The intel fixes should contain the fix for the touchpad on the
        Chromebook - hey I'm an input maintainer now!"
      
      Hate to pee on your parade, Dave, but I don't think being an input
      maintainer is necessarily something to strive for..
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (25 commits)
        drm/tegra: drop "select DRM_HDMI"
        drm: Documentation typo fixes
        drm/mgag200: Bug fix: Renesas board now selects native resolution.
        drm/mgag200: Reject modes that are too big for VRAM
        drm/mgag200: 'fbdev_list' in 'struct mga_fbdev' is not used
        drm/radeon: don't check mipmap alignment if MIP_ADDRESS is FMASK
        drm/radeon: skip MC reset as it's probably not hung
        drm/radeon: add primary dac adj quirk for R200 board
        drm/radeon: don't set hpd, afmt interrupts when interrupts are disabled
        drm/i915: Turn off hsync and vsync on ADPA when disabling crt
        drm/i915: Fix incorrect definition of ADPA HSYNC and VSYNC bits
        drm/i915: also disable south interrupts when handling them
        drm/i915: enable irqs earlier when resuming
        drm/i915: Increase the RC6p threshold.
        DRM/i915: On G45 enable cursor plane briefly after enabling the display plane.
        drm/nv50-: prevent some races between modesetting and page flipping
        drm/nouveau/i2c: drop parent refcount when creating ports
        drm/nv84: fix regression in page flipping
        drm/nouveau: Fix typo in init_idx_addr_latched().
        drm/nouveau: Disable AGP on PowerPC again.
        ...
      af2841cd
    • L
      Merge tag 'pm+acpi-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · c89b148f
      Linus Torvalds 提交于
      Pull ACPI and power management fixes from Rafael J Wysocki:
      
       - Two fixes for the new intel_pstate driver from Dirk Brandewie.
      
       - Fix for incorrect usage of the .find_bridge() callback from struct
         acpi_bus_type in the USB core and subsequent removal of that callback
         from Rafael J Wysocki.
      
       - ACPI processor driver cleanups from Chen Gang and Syam Sidhardhan.
      
       - ACPI initialization and error messages fix from Joe Perches.
      
       - Operating Performance Points documentation improvement from Nishanth
         Menon.
      
       - Fixes for memory leaks and potential concurrency issues and sysfs
        attributes leaks during device removal in the core device PM QoS code
        from Rafael J Wysocki.
      
       - Calxeda Highbank cpufreq driver simplification from Emilio López.
      
       - cpufreq comment cleanup from Namhyung Kim.
      
       - Fix for a section mismatch in Calxeda Highbank interprocessor
         communication code from Mark Langsdorf (this is not a PM fix strictly
         speaking, but the code in question went in through the PM tree).
      
      * tag 'pm+acpi-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq / intel_pstate: Do not load on VM that does not report max P state.
        cpufreq / intel_pstate: Fix intel_pstate_init() error path
        ACPI / glue: Drop .find_bridge() callback from struct acpi_bus_type
        ACPI / glue: Add .match() callback to struct acpi_bus_type
        ACPI / porocessor: Beautify code, pr->id is u32 which is never < 0
        ACPI / processor: Remove redundant NULL check before kfree
        ACPI / Sleep: Avoid interleaved message on errors
        PM / QoS: Remove device PM QoS sysfs attributes at the right place
        PM / QoS: Fix concurrency issues and memory leaks in device PM QoS
        cpufreq: highbank: do not initialize array with a loop
        PM / OPP: improve introductory documentation
        cpufreq: Fix a typo in comment
        mailbox, pl320-ipc: remove __init from probe function
      c89b148f
    • P
      drm/tegra: drop "select DRM_HDMI" · 36c1813b
      Paul Bolle 提交于
      Commit ac24c220 ("drm/tegra: Use generic
      HDMI infoframe helpers") added "select DRM_HDMI" to the DRM_TEGRA
      Kconfig entry. But there is no Kconfig symbol named DRM_HDMI. The select
      statement for that symbol is a nop. Drop it.
      
      What was needed to use HDMI functionality was to select HDMI (which this
      entry already did through depending on DRM) and to include linux/hdmi.h
      (which this commit also did).
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Acked-by: NThierry Reding <thierry.reding@avionic-design.de>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      36c1813b