1. 11 Aug, 2013 7 commits
  2. 04 Aug, 2013 33 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.4.56 · 7b17c579
      Greg Kroah-Hartman authored
      7b17c579
    • Wanpeng Li's avatar
      mm/memory-hotplug: fix lowmem count overflow when offline pages · 19d22ea8
      Wanpeng Li authored
      commit cea27eb2 upstream.
      
      The logic for the memory-remove code fails to correctly account the
      Total High Memory when a memory block which contains High Memory is
      offlined as shown in the example below.  The following patch fixes it.
      
      Before logic memory remove:
      
      MemTotal:        7603740 kB
      MemFree:         6329612 kB
      Buffers:           94352 kB
      Cached:           872008 kB
      SwapCached:            0 kB
      Active:           626932 kB
      Inactive:         519216 kB
      Active(anon):     180776 kB
      Inactive(anon):   222944 kB
      Active(file):     446156 kB
      Inactive(file):   296272 kB
      Unevictable:           0 kB
      Mlocked:               0 kB
      HighTotal:       7294672 kB
      HighFree:        5704696 kB
      LowTotal:         309068 kB
      LowFree:          624916 kB
      
      After logic memory remove:
      
      MemTotal:        7079452 kB
      MemFree:         5805976 kB
      Buffers:           94372 kB
      Cached:           872000 kB
      SwapCached:            0 kB
      Active:           626936 kB
      Inactive:         519236 kB
      Active(anon):     180780 kB
      Inactive(anon):   222944 kB
      Active(file):     446156 kB
      Inactive(file):   296292 kB
      Unevictable:           0 kB
      Mlocked:               0 kB
      HighTotal:       7294672 kB
      HighFree:        5181024 kB
      LowTotal:       4294752076 kB
      LowFree:          624952 kB
      
      [mhocko@suse.cz: fix CONFIG_HIGHMEM=n build]
      Signed-off-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
      Reviewed-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: <stable@vger.kernel.org>	[2.6.24+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarZhouping Liu <zliu@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19d22ea8
    • Michael S. Tsirkin's avatar
      virtio_net: fix race in RX VQ processing · 40a017c9
      Michael S. Tsirkin authored
      commit cbdadbbf upstream
      
      virtio net called virtqueue_enable_cq on RX path after napi_complete, so
      with NAPI_STATE_SCHED clear - outside the implicit napi lock.
      This violates the requirement to synchronize virtqueue_enable_cq wrt
      virtqueue_add_buf.  In particular, used event can move backwards,
      causing us to lose interrupts.
      In a debug build, this can trigger panic within START_USE.
      
      Jason Wang reports that he can trigger the races artificially,
      by adding udelay() in virtqueue_enable_cb() after virtio_mb().
      
      However, we must call napi_complete to clear NAPI_STATE_SCHED before
      polling the virtqueue for used buffers, otherwise napi_schedule_prep in
      a callback will fail, causing us to lose RX events.
      
      To fix, call virtqueue_enable_cb_prepare with NAPI_STATE_SCHED
      set (under napi lock), later call virtqueue_poll with
      NAPI_STATE_SCHED clear (outside the lock).
      Reported-by: default avatarJason Wang <jasowang@redhat.com>
      Tested-by: default avatarJason Wang <jasowang@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [wg: Backported to 3.2]
      Signed-off-by: default avatarWolfram Gloger <wmglo@dent.med.uni-muenchen.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40a017c9
    • Michael S. Tsirkin's avatar
      virtio: support unlocked queue poll · 2010fa31
      Michael S. Tsirkin authored
      commit cc229884 upstream.
      
      This adds a way to check ring empty state after enable_cb outside any
      locks. Will be used by virtio_net.
      
      Note: there's room for more optimization: caller is likely to have a
      memory barrier already, which means we might be able to get rid of a
      barrier here.  Deferring this optimization until we do some
      benchmarking.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [wg: Backported to 3.2]
      Signed-off-by: default avatarWolfram Gloger <wmglo@dent.med.uni-muenchen.de>
      [bwh: Backported to 3.4: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2010fa31
    • Linus Torvalds's avatar
      s390: move dummy io_remap_pfn_range() to asm/pgtable.h · c733e1a2
      Linus Torvalds authored
      commit 4f2e2903 upstream.
      
      Commit b4cbb197 ("vm: add vm_iomap_memory() helper function") added
      a helper function wrapper around io_remap_pfn_range(), and every other
      architecture defined it in <asm/pgtable.h>.
      
      The s390 choice of <asm/io.h> may make sense, but is not very convenient
      for this case, and gratuitous differences like that cause unexpected errors like this:
      
         mm/memory.c: In function 'vm_iomap_memory':
         mm/memory.c:2439:2: error: implicit declaration of function 'io_remap_pfn_range' [-Werror=implicit-function-declaration]
      
      Glory be the kbuild test robot who noticed this, bisected it, and
      reported it to the guilty parties (ie me).
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      [bwh: Backported to 3.2: the macro was not defined, so this is an addition
       and not a move]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c733e1a2
    • Steffen Maier's avatar
      zfcp: status read buffers on first adapter open with link down · 17a9afa3
      Steffen Maier authored
      commit 9edf7d75 upstream.
      
      Commit 64deb6ef
      "[SCSI] zfcp: Use status_read_buf_num provided by FCP channel"
      started using a value returned by the channel but only evaluated the value
      if the fabric link is up.
      Commit 8d88cf3f
      "[SCSI] zfcp: Update status read mempool"
      introduced mempool resizings based on the above value.
      On setting an FCP device online for the very first time since boot, a new
      zeroed adapter object is allocated. If the link is down, the number of
      status read requests remains zero. Since just the config data exchange is
      incomplete, we proceed with adapter open recovery. However, we
      unconditionally call mempool_resize with adapter->stat_read_buf_num == 0 in
      this case.
      
      This causes a kernel message "kernel BUG at mm/mempool.c:131!" in process
      "zfcperp<FCP-device-bus-ID>" with last function mempool_resize in Krnl PSW
      and zfcp_erp_thread in the Call Trace.
      
      Don't evaluate channel values which are invalid on link down. The number of
      status read requests is always valid, evaluated, and set to a positive
      minimum greater than zero. The adapter open recovery can proceed and the
      channel has status read buffers to inform us on a future link up event.
      While we are not aware of any other code path that could result in mempool
      resize attempts of size zero, we still also initialize the number of status
      read buffers to be posted to a static minimum number on adapter object
      allocation.
      
      Backported for 3.4-stable. commit a53c8fab since v3.6-rc1 unified
      copyright messages, e.g: revise such messages 'Copyright IBM Corporation'
      as 'Copyright IBM Corp', so updated the messages as a53c8fab did.
      Signed-off-by: default avatarSteffen Maier <maier@linux.vnet.ibm.com>
      Cc: <stable@vger.kernel.org> #2.6.35+
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarZhouping Liu <zliu@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17a9afa3
    • Clemens Ladisch's avatar
      firewire: fix libdc1394/FlyCap2 iso event regression · a90a3ade
      Clemens Ladisch authored
      commit 0699a73a upstream.
      
      Commit 18d62711 (firewire: prevent dropping of completed iso packet
      header data) was intended to be an obvious bug fix, but libdc1394 and
      FlyCap2 depend on the old behaviour by ignoring all returned information
      and thus not noticing that not all packets have been received yet.  The
      result was that the video frame buffers would be saved before they
      contained the correct data.
      
      Reintroduce the old behaviour for old clients.
      Tested-by: default avatarStepan Salenikovich <stepan.salenikovich@gmail.com>
      Tested-by: default avatarJosep Bosch <jep250@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.4+
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a90a3ade
    • David Vrabel's avatar
      xen/evtchn: avoid a deadlock when unbinding an event channel · 8924588c
      David Vrabel authored
      commit 179fbd5a upstream.
      
      Unbinding an event channel (either with the ioctl or when the evtchn
      device is closed) may deadlock because disable_irq() is called with
      port_user_lock held which is also locked by the interrupt handler.
      
      Think of the IOCTL_EVTCHN_UNBIND is being serviced, the routine has
      just taken the lock, and an interrupt happens. The evtchn_interrupt
      is invoked, tries to take the lock and spins forever.
      
      A quick glance at the code shows that the spinlock is a local IRQ
      variant. Unfortunately that does not help as "disable_irq() waits for
      the interrupt handler on all CPUs to stop running.  If the irq occurs
      on another VCPU, it tries to take port_user_lock and can't because
      the unbind ioctl is holding it." (from David). Hence we cannot
      depend on the said spinlock to protect us. We could make it a system
      wide IRQ disable spinlock but there is a better way.
      
      We can piggyback on the fact that the existence of the spinlock is
      to make get_port_user() checks be up-to-date. And we can alter those
      checks to not depend on the spin lock (as it's protected by u->bind_mutex
      in the ioctl) and can remove the unnecessary locking (this is
      IOCTL_EVTCHN_UNBIND) path.
      
      In the interrupt handler we cannot use the mutex, but we do not
      need it.
      
      "The unbind disables the irq before making the port user stale, so when
      you clear it you are guaranteed that the interrupt handler that might
      use that port cannot be running." (from David).
      
      Hence this patch removes the spinlock usage on the teardown path
      and piggybacks on disable_irq happening before we muck with the
      get_port_user() data. This ensures that the interrupt handler will
      never run on stale data.
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v1: Expanded the commit description a bit]
      Signed-off-by: default avatarJonghwan Choi <jhbird.choi@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8924588c
    • NeilBrown's avatar
      md/raid10: remove use-after-free bug. · aa2f8abe
      NeilBrown authored
      commit 0eb25bb0 upstream.
      
      We always need to be careful when calling generic_make_request, as it
      can start a chain of events which might free something that we are
      using.
      
      Here is one place I wasn't careful enough.  If the wbio2 is not in
      use, then it might get freed at the first generic_make_request call.
      So perform all necessary tests first.
      
      This bug was introduced in 3.3-rc3 (24afd80d) and can cause an
      oops, so fix is suitable for any -stable since then.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa2f8abe
    • NeilBrown's avatar
      md/raid5: fix interaction of 'replace' and 'recovery'. · 0761d079
      NeilBrown authored
      commit f94c0b66 upstream.
      
      If a device in a RAID4/5/6 is being replaced while another is being
      recovered, then the writes to the replacement device currently don't
      happen, resulting in corruption when the replacement completes and the
      new drive takes over.
      
      This is because the replacement writes are only triggered when
      's.replacing' is set and not when the similar 's.sync' is set (which
      is the case during resync and recovery - it means all devices need to
      be read).
      
      So schedule those writes when s.replacing is set as well.
      
      In this case we cannot use "STRIPE_INSYNC" to record that the
      replacement has happened as that is needed for recording that any
      parity calculation is complete.  So introduce STRIPE_REPLACED to
      record if the replacement has happened.
      
      For safety we should also check that STRIPE_COMPUTE_RUN is not set.
      This has a similar effect to the "s.locked == 0" test.  The latter
      ensure that now IO has been flagged but not started.  The former
      checks if any parity calculation has been flagged by not started.
      We must wait for both of these to complete before triggering the
      'replace'.
      
      Add a similar test to the subsequent check for "are we finished yet".
      This possibly isn't needed (is subsumed in the STRIPE_INSYNC test),
      but it makes it more obvious that the REPLACE will happen before we
      think we are finished.
      
      Finally if a NeedReplace device is not UPTODATE then that is an
      error.  We really must trigger a warning.
      
      This bug was introduced in commit 9a3e1101
      (md/raid5:  detect and handle replacements during recovery.)
      which introduced replacement for raid5.
      That was in 3.3-rc3, so any stable kernel since then would benefit
      from this fix.
      Reported-by: default avatarqindehua <13691222965@163.com>
      Tested-by: default avatarqindehua <qindehua@163.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0761d079
    • Al Viro's avatar
      livelock avoidance in sget() · 257e1c5c
      Al Viro authored
      commit acfec9a5 upstream.
      
      Eric Sandeen has found a nasty livelock in sget() - take a mount(2) about
      to fail.  The superblock is on ->fs_supers, ->s_umount is held exclusive,
      ->s_active is 1.  Along comes two more processes, trying to mount the same
      thing; sget() in each is picking that superblock, bumping ->s_count and
      trying to grab ->s_umount.  ->s_active is 3 now.  Original mount(2)
      finally gets to deactivate_locked_super() on failure; ->s_active is 2,
      superblock is still ->fs_supers because shutdown will *not* happen until
      ->s_active hits 0.  ->s_umount is dropped and now we have two processes
      chasing each other:
      s_active = 2, A acquired ->s_umount, B blocked
      A sees that the damn thing is stillborn, does deactivate_locked_super()
      s_active = 1, A drops ->s_umount, B gets it
      A restarts the search and finds the same superblock.  And bumps it ->s_active.
      s_active = 2, B holds ->s_umount, A blocked on trying to get it
      ... and we are in the earlier situation with A and B switched places.
      
      The root cause, of course, is that ->s_active should not grow until we'd
      got MS_BORN.  Then failing ->mount() will have deactivate_locked_super()
      shut the damn thing down.  Fortunately, it's easy to do - the key point
      is that grab_super() is called only for superblocks currently on ->fs_supers,
      so it can bump ->s_count and grab ->s_umount first, then check MS_BORN and
      bump ->s_active; we must never increment ->s_count for superblocks past
      ->kill_sb(), but grab_super() is never called for those.
      
      The bug is pretty old; we would've caught it by now, if not for accidental
      exclusion between sget() for block filesystems; the things like cgroup or
      e.g. mtd-based filesystems don't have anything of that sort, so they get
      bitten.  The right way to deal with that is obviously to fix sget()...
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      257e1c5c
    • Rick Farina (Zero_Chaos)'s avatar
      USB: serial: ftdi_sio: add more RT Systems ftdi devices · 428f268e
      Rick Farina (Zero_Chaos) authored
      commit fed1f1ed upstream.
      
      RT Systems makes many usb serial cables based on the ftdi_sio driver for
      programming various amateur radios.  This patch is a full listing of
      their current product offerings and should allow these cables to all
      be recognized.
      Signed-off-by: default avatarRick Farina (Zero_Chaos) <zerochaos@gentoo.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      428f268e
    • Alex Deucher's avatar
      drm/radeon/atom: initialize more atom interpretor elements to 0 · 1996c980
      Alex Deucher authored
      commit 42a21826 upstream.
      
      The ProcessAuxChannel table on some rv635 boards assumes
      the divmul members are initialized to 0 otherwise we get
      an invalid fb offset since it has a bad mask set when
      setting the fb base.  While here initialize all the
      atom interpretor elements to 0.
      
      Fixes:
      https://bugzilla.kernel.org/show_bug.cgi?id=60639Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1996c980
    • Alex Deucher's avatar
      drm/radeon: improve dac adjust heuristics for legacy pdac · e41f203d
      Alex Deucher authored
      commit 03ed8cf9 upstream.
      
      Hopefully avoid more quirks in the future due to bogus
      vbios dac data.
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e41f203d
    • Mark Kettenis's avatar
      drm/radeon: fix combios tables on older cards · b076cb4e
      Mark Kettenis authored
      commit cef1d00c upstream.
      
      Noticed that my old Radeon 7500 hung after printing
      
         drm: GPU not posted. posting now...
      
      when it wasn't selected as the primary card the BIOS.  Some digging
      revealed that it was hanging in combios_parse_mmio_table() while
      parsing the ASIC INIT 3 table.  Looking at the BIOS ROM for the card,
      it becomes obvious that there is no ASIC INIT 3 table in the BIOS.
      The code is just processing random garbage.  No surprise it hangs!
      
      Why do I say that there is no ASIC INIT 3 table is the BIOS?  This
      table is found through the MISC INFO table.  The MISC INFO table can
      be found at offset 0x5e in the COMBIOS header.  But the header is
      smaller than that.  The COMBIOS header starts at offset 0x126.  The
      standard PCI Data Structure (the bit that starts with 'PCIR') lives at
      offset 0x180.  That means that the COMBIOS header can not be larger
      than 0x5a bytes and therefore cannot contain a MISC INFO table.
      
      I looked at a dozen or so BIOS images, some my own, some downloaded from:
      
          <http://www.techpowerup.com/vgabios/index.php?manufacturer=ATI&page=1>
      
      It is fairly obvious that the size of the COMBIOS header can be found
      at offset 0x6 of the header.  Not sure if it is a 16-bit number or
      just an 8-bit number, but that doesn't really matter since the tables
      seems to be always smaller than 256 bytes.
      
      So I think combios_get_table_offset() should check if the requested
      table is present.  This can be done by checking the offset against the
      size of the header.  See the diff below.  The diff is against the WIP
      OpenBSD codebase that roughly corresponds to Linux 3.8.13 at this
      point.  But I don't think this bit of the code changed much since
      then.
      
      For what it is worth:
      Signed-off-by: default avatarMark Kettenis <kettenis@openbsd.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b076cb4e
    • Alex Deucher's avatar
      drm/radeon: fix endian issues with DP handling (v3) · 03223102
      Alex Deucher authored
      commit 34be8c9a upstream.
      
      The atom interpreter expects data in LE format, so
      swap the message buffer as apprioriate.
      
      v2: properly handle non-dw aligned byte counts.
      v3: properly handle remainder
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: Dong He <hedonghust@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03223102
    • Mikulas Patocka's avatar
      dm verity: fix inability to use a few specific devices sizes · 0990072e
      Mikulas Patocka authored
      commit b1bf2de0 upstream.
      
      Fix a boundary condition that caused failure for certain device sizes.
      
      The problem is reported at
        http://code.google.com/p/cryptsetup/issues/detail?id=160
      
      For certain device sizes the number of hashes at a specific level was
      calculated incorrectly.
      
      It happens for example for a device with data and metadata block size 4096
      that has 16385 blocks and algorithm sha256.
      
      The user can test if he is affected by this bug by running the
      "veritysetup verify" command and also by activating the dm-verity kernel
      driver and reading the whole block device. If it passes without an error,
      then the user is not affected.
      
      The condition for the bug is:
      
      Split the total number of data blocks (data_block_bits) into bit strings,
      each string has hash_per_block_bits bits. hash_per_block_bits is
      rounddown(log2(metadata_block_size/hash_digest_size)). Equivalently, you
      can say that you convert data_blocks_bits to 2^hash_per_block_bits base.
      
      If there some zero bit string below the most significant bit string and at
      least one bit below this zero bit string is set, then the bug happens.
      
      The same bug exists in the userspace veritysetup tool, so you must use
      fixed veritysetup too if you want to use devices that are affected by
      this boundary condition.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: Milan Broz <gmazyland@gmail.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0990072e
    • Toshi Kani's avatar
      ACPI / memhotplug: Fix a stale pointer in error path · 5201cbf1
      Toshi Kani authored
      commit d19f503e upstream.
      
      device->driver_data needs to be cleared when releasing its data,
      mem_device, in an error path of acpi_memory_device_add().
      
      The function evaluates the _CRS of memory device objects, and fails
      when it gets an unexpected resource or cannot allocate memory.  A
      kernel crash or data corruption may occur when the kernel accesses
      the stale pointer.
      Signed-off-by: default avatarToshi Kani <toshi.kani@hp.com>
      Reviewed-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5201cbf1
    • Anton Blanchard's avatar
      powerpc/modules: Module CRC relocation fix causes perf issues · ef445a32
      Anton Blanchard authored
      commit 0e0ed640 upstream.
      
      Module CRCs are implemented as absolute symbols that get resolved by
      a linker script. We build an intermediate .o that contains an
      unresolved symbol for each CRC. genksysms parses this .o, calculates
      the CRCs and writes a linker script that "resolves" the symbols to
      the calculated CRC.
      
      Unfortunately the ppc64 relocatable kernel sees these CRCs as symbols
      that need relocating and relocates them at boot. Commit d4703aef
      (module: handle ppc64 relocating kcrctabs when CONFIG_RELOCATABLE=y)
      added a hook to reverse the bogus relocations. Part of this patch
      created a symbol at 0x0:
      
      # head -2 /proc/kallsyms
      0000000000000000 T reloc_start
      c000000000000000 T .__start
      
      This reloc_start symbol is causing lots of confusion to perf. It
      thinks reloc_start is a massive function that stretches from 0x0 to
      0xc000000000000000 and we get various cryptic errors out of perf,
      including:
      
      problem incrementing symbol count, skipping event
      
      This patch removes the  reloc_start linker script label and instead
      defines it as PHYSICAL_START. We also need to wrap it with
      CONFIG_PPC64 because the ppc32 kernel can set a non zero
      PHYSICAL_START at compile time and we wouldn't want to subtract
      it from the CRCs in that case.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef445a32
    • Tejun Heo's avatar
      libata: make it clear that sata_inic162x is experimental · af5697cd
      Tejun Heo authored
      commit bb969619 upstream.
      
      sata_inic162x never reached a state where it's reliable enough for
      production use and data corruption is a relatively common occurrence.
      Make the driver generate warning about the issues and mark the Kconfig
      option as experimental.
      
      If the situation doesn't improve, we'd be better off making it depend
      on CONFIG_BROKEN.  Let's wait for several cycles and see if the kernel
      message draws any attention.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarMartin Braure de Calignon <braurede@free.fr>
      Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Reported-by: risc4all@yahoo.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af5697cd
    • Youquan Song's avatar
      ata: Fix DVD not dectected at some platform with Wellsburg PCH · 82627ff3
      Youquan Song authored
      commit eac27f04 upstream.
      
      There is a patch b55f84e2 "ata_piix: Fix DVD
       not dectected at some Haswell platforms" to fix an issue of DVD not
      recognized on Haswell Desktop platform with Lynx Point.
      Recently, it is also found the same issue at some platformas with Wellsburg PCH.
      
      So deliver a similar patch to fix it by disables 32bit PIO in IDE mode.
      Signed-off-by: default avatarYouquan Song <youquan.song@intel.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82627ff3
    • Konrad Rzeszutek Wilk's avatar
      xen/blkback: Check device permissions before allowing OP_DISCARD · 8f5a2856
      Konrad Rzeszutek Wilk authored
      commit 604c499c upstream.
      
      We need to make sure that the device is not RO or that
      the request is not past the number of sectors we want to
      issue the DISCARD operation for.
      
      This fixes CVE-2013-2140.
      Acked-by: default avatarJan Beulich <JBeulich@suse.com>
      Acked-by: default avatarIan Campbell <Ian.Campbell@citrix.com>
      [v1: Made it pr_warn instead of pr_debug]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f5a2856
    • Josef Bacik's avatar
      Btrfs: re-add root to dead root list if we stop dropping it · e94d695a
      Josef Bacik authored
      commit d29a9f62 upstream.
      
      If we stop dropping a root for whatever reason we need to add it back to the
      dead root list so that we will re-start the dropping next transaction commit.
      The other case this happens is if we recover a drop because we will add a root
      without adding it to the fs radix tree, so we can leak it's root and commit root
      extent buffer, adding this to the dead root list makes this cleanup happen.
      Thanks,
      Reported-by: default avatarAlex Lyakas <alex.btrfs@zadarastorage.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e94d695a
    • Josef Bacik's avatar
      Btrfs: fix lock leak when resuming snapshot deletion · 849f48ae
      Josef Bacik authored
      commit fec386ac upstream.
      
      We aren't setting path->locks[level] when we resume a snapshot deletion which
      means we won't unlock the buffer when we free the path.  This causes deadlocks
      if we happen to re-allocate the block before we've evicted the extent buffer
      from cache.  Thanks,
      Reported-by: default avatarAlex Lyakas <alex.btrfs@zadarastorage.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      849f48ae
    • Ian Abbott's avatar
      staging: comedi: COMEDI_CANCEL ioctl should wake up read/write · cf63fbd4
      Ian Abbott authored
      commit 69acbaac upstream.
      
      Comedi devices can do blocking read() or write() (or poll()) if an
      asynchronous command has been set up, blocking for data (for read()) or
      buffer space (for write()).  Various events associated with the
      asynchronous command will wake up the blocked reader or writer (or
      poller).  It is also possible to force the asynchronous command to
      terminate by issuing a `COMEDI_CANCEL` ioctl.  That shuts down the
      asynchronous command, but does not currently wake up the blocked reader
      or writer (or poller).  If the blocked task could be woken up, it would
      see that the command is no longer active and return.  The caller of the
      `COMEDI_CANCEL` ioctl could attempt to wake up the blocked task by
      sending a signal, but that's a nasty workaround.
      
      Change `do_cancel_ioctl()` to wake up the wait queue after it returns
      from `do_cancel()`.  `do_cancel()` can propagate an error return value
      from the low-level comedi driver's cancel routine, but it always shuts
      the command down regardless, so `do_cancel_ioctl()` can wake up he wait
      queue regardless of the return value from `do_cancel()`.
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf63fbd4
    • William Gulland's avatar
      usb: Clear both buffers when clearing a control transfer TT buffer. · 9e914980
      William Gulland authored
      commit 2c7b871b upstream.
      
      Control transfers have both IN and OUT (or SETUP) packets, so when
      clearing TT buffers for a control transfer it's necessary to send
      two HUB_CLEAR_TT_BUFFER requests to the hub.
      Signed-off-by: default avatarWilliam Gulland <wgulland@google.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e914980
    • Jóhann B. Guðmundsson's avatar
    • Johan Hovold's avatar
      USB: ti_usb_3410_5052: fix dynamic-id matching · 9f510a82
      Johan Hovold authored
      commit 1fad5642 upstream.
      
      The driver failed to take the dynamic ids into account when determining
      the device type and therefore all devices were detected as 2-port
      devices when using the dynamic-id interface.
      
      Match on the usb-serial-driver field instead of doing redundant id-table
      searches.
      Reported-by: default avatarAnders Hammarquist <iko@iko.pp.se>
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f510a82
    • Felipe Balbi's avatar
      usb: dwc3: gadget: don't prevent gadget from being probed if we fail · 1b5c94b7
      Felipe Balbi authored
      commit cdcedd69 upstream.
      
      In case we fail our ->udc_start() callback, we
      should be ready to accept another modprobe following
      the failed one.
      
      We had forgotten to clear dwc->gadget_driver back
      to NULL and, because of that, we were preventing
      gadget driver modprobe from being retried.
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b5c94b7
    • Huang Rui's avatar
      usb: dwc3: fix wrong bit mask in dwc3_event_type · 76d54f0a
      Huang Rui authored
      commit 1974d494 upstream.
      
      Per dwc3 2.50a spec, the is_devspec bit is used to distinguish the
      Device Endpoint-Specific Event or Device-Specific Event (DEVT). If the
      bit is 1, the event is represented Device-Specific Event, then use
      [7:1] bits as Device Specific Event to marked the type. It has 7 bits,
      and we can see the reserved8_31 variable name which means from 8 to 31
      bits marked reserved, actually there are 24 bits not 25 bits between
      that. And 1 + 7 + 24 = 32, the event size is 4 byes.
      
      So in dwc3_event_type, the bit mask should be:
      is_devspec	[0]		1  bit
      type		[7:1]		7  bits
      reserved8_31	[31:8]		24 bits
      
      This patch should be backported to kernels as old as 3.2, that contain
      the commit 72246da4 "usb: Introduce
      DesignWare USB3 DRD Driver".
      Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76d54f0a
    • Sarah Sharp's avatar
      xhci: Avoid NULL pointer deref when host dies. · 79bc1750
      Sarah Sharp authored
      commit 203a8661 upstream.
      
      When the host controller fails to respond to an Enable Slot command, and
      the host fails to respond to the register write to abort the command
      ring, the xHCI driver will assume the host is dead, and call
      usb_hc_died().
      
      The USB device's slot_id is still set to zero, and the pointer stored at
      xhci->devs[0] will always be NULL.  The call to xhci_check_args in
      xhci_free_dev should have caught the NULL virt_dev pointer.
      
      However, xhci_free_dev is designed to free the xhci_virt_device
      structures, even if the host is dead, so that we don't leak kernel
      memory.  xhci_free_dev checks the return value from the generic
      xhci_check_args function.  If the return value is -ENODEV, it carries on
      trying to free the virtual device.
      
      The issue is that xhci_check_args looks at the host controller state
      before it looks at the xhci_virt_device pointer.  It will return -ENIVAL
      because the host is dead, and xhci_free_dev will ignore the return
      value, and happily dereference the NULL xhci_virt_device pointer.
      
      The fix is to make sure that xhci_check_args checks the xhci_virt_device
      pointer before it checks the host state.
      
      See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1203453 for
      further details.  This patch doesn't solve the underlying issue, but
      will ensure we don't see any more NULL pointer dereferences because of
      the issue.
      
      This patch should be backported to kernels as old as 3.1, that
      contain the commit 7bd89b40 "xhci: Don't
      submit commands or URBs to halted hosts."
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Reported-by: default avatarVincent Thiele <vincentthiele@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79bc1750
    • Oleksij Rempel's avatar
      xhci: fix null pointer dereference on ring_doorbell_for_active_rings · 00a71cc4
      Oleksij Rempel authored
      commit d66eaf9f upstream.
      
      in some cases where device is attched to xhci port and do not responding,
      for example ath9k_htc with stalled firmware, kernel will
      crash on ring_doorbell_for_active_rings.
      This patch check if pointer exist before it is used.
      
      This patch should be backported to kernels as old as 2.6.35, that
      contain the commit e9df17eb "USB: xhci:
      Correct assumptions about number of rings per endpoint"
      Signed-off-by: default avatarOleksij Rempel <linux@rempel-privat.de>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      00a71cc4
    • George Cherian's avatar
      usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 · 2d75d5d8
      George Cherian authored
      commit 07f3cb7c upstream.
      
      Xhci controllers with hci_version > 0.96 gives spurious success
      events on short packet completion. During webcam capture the
      "ERROR Transfer event TRB DMA ptr not part of current TD" was observed.
      The same application works fine with synopsis controllers hci_version 0.96.
      The same issue is seen with Intel Pantherpoint xhci controller. So enabling
      this quirk in xhci_gen_setup if controller verion is greater than 0.96.
      For xhci-pci move the quirk to much generic place xhci_gen_setup.
      
      Note from Sarah:
      
      The xHCI 1.0 spec changed how hardware handles short packets.  The HW
      will notify SW of the TRB where the short packet occurred, and it will
      also give a successful status for the last TRB in a TD (the one with the
      IOC flag set).  On the second successful status, that warning will be
      triggered in the driver.
      
      Software is now supposed to not assume the TD is not completed until it
      gets that last successful status.  That means we have a slight race
      condition, although it should have little practical impact.  This patch
      papers over that issue.
      
      It's on my long-term to-do list to fix this race condition, but it is a
      much more involved patch that will probably be too big for stable.  This
      patch is needed for stable to avoid serious log spam.
      
      This patch should be backported to kernels as old as 3.0, that
      contain the commit ad808333 "Intel xhci:
      Ignore spurious successful event."
      
      The patch will have to be modified for kernels older than 3.2, since
      that kernel added the xhci_gen_setup function for xhci platform devices.
      The correct conflict resolution for kernels older than 3.2 is to set
      XHCI_SPURIOUS_SUCCESS in xhci_pci_quirks for all xHCI 1.0 hosts.
      Signed-off-by: default avatarGeorge Cherian <george.cherian@ti.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d75d5d8