1. 10 Oct, 2014 40 commits
    • Steven Rostedt (Red Hat)'s avatar
      ftrace: Update all ftrace_ops for a ftrace_hash_ops update · 14ed89e4
      Steven Rostedt (Red Hat) authored
      When updating what an ftrace_ops traces, if it is registered (that is,
      actively tracing), and that ftrace_ops uses the shared global_ops
      local_hash, then we need to update all tracers that are active and
      also share the global_ops' ftrace_hash_ops.
      
      Cc: stable@vger.kernel.org # 3.16 (apply after 3.17-rc4 is out)
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit 84261912)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      14ed89e4
    • Felipe Balbi's avatar
      usb: dwc3: fix TRB completion when multiple TRBs are started · 98f09ad0
      Felipe Balbi authored
      After commit 2ec2a8be (usb: dwc3: gadget:
      always enable IOC on bulk/interrupt transfers)
      we created a situation where it was possible to
      hang a bulk/interrupt endpoint if we had more
      than one pending request in our queue and they
      were both started with a single Start Transfer
      command.
      
      The problems triggers because we had not enabled
      Transfer In Progress event for those endpoints
      and we were not able to process early giveback
      of requests completed without LST bit set.
      
      Fix the problem by finally enabling Xfer In Progress
      event for all endpoint types, except control.
      
      Fixes: 2ec2a8be (usb: dwc3: gadget: always
      	enable IOC on bulk/interrupt transfers)
      Cc: <stable@vger.kernel.org> # v3.14+
      Reported-by: default avatarPratyush Anand <pratyush.anand@st.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      
      (cherry picked from commit 0b93a4c8)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      98f09ad0
    • Jens Axboe's avatar
      genhd: fix leftover might_sleep() in blk_free_devt() · 76bef4ac
      Jens Axboe authored
      Commit 2da78092 changed the locking from a mutex to a spinlock,
      so we now longer sleep in this context. But there was a leftover
      might_sleep() in there, which now triggers since we do the final
      free from an RCU callback. Get rid of it.
      Reported-by: default avatarPontus Fuchs <pontus.fuchs@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      
      (cherry picked from commit 46f341ff)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      76bef4ac
    • J. Bruce Fields's avatar
      lockd: fix rpcbind crash on lockd startup failure · 39c3e370
      J. Bruce Fields authored
      Nikita Yuschenko reported that booting a kernel with init=/bin/sh and
      then nfs mounting without portmap or rpcbind running using a busybox
      mount resulted in:
      
        # mount -t nfs 10.30.130.21:/opt /mnt
        svc: failed to register lockdv1 RPC service (errno 111).
        lockd_up: makesock failed, error=-111
        Unable to handle kernel paging request for data at address 0x00000030
        Faulting instruction address: 0xc055e65c
        Oops: Kernel access of bad area, sig: 11 [#1]
        MPC85xx CDS
        Modules linked in:
        CPU: 0 PID: 1338 Comm: mount Not tainted 3.10.44.cge #117
        task: cf29cea0 ti: cf35c000 task.ti: cf35c000
        NIP: c055e65c LR: c0566490 CTR: c055e648
        REGS: cf35dad0 TRAP: 0300   Not tainted  (3.10.44.cge)
        MSR: 00029000 <CE,EE,ME>  CR: 22442488  XER: 20000000
        DEAR: 00000030, ESR: 00000000
      
        GPR00: c05606f4 cf35db80 cf29cea0 cf0ded80 cf0dedb8 00000001 1dec3086
        00000000
        GPR08: 00000000 c07b1640 00000007 1dec3086 22442482 100b9758 00000000
        10090ae8
        GPR16: 00000000 000186a5 00000000 00000000 100c3018 bfa46edc 100b0000
        bfa46ef0
        GPR24: cf386ae0 c07834f0 00000000 c0565f88 00000001 cf0dedb8 00000000
        cf0ded80
        NIP [c055e65c] call_start+0x14/0x34
        LR [c0566490] __rpc_execute+0x70/0x250
        Call Trace:
        [cf35db80] [00000080] 0x80 (unreliable)
        [cf35dbb0] [c05606f4] rpc_run_task+0x9c/0xc4
        [cf35dbc0] [c0560840] rpc_call_sync+0x50/0xb8
        [cf35dbf0] [c056ee90] rpcb_register_call+0x54/0x84
        [cf35dc10] [c056f24c] rpcb_register+0xf8/0x10c
        [cf35dc70] [c0569e18] svc_unregister.isra.23+0x100/0x108
        [cf35dc90] [c0569e38] svc_rpcb_cleanup+0x18/0x30
        [cf35dca0] [c0198c5c] lockd_up+0x1dc/0x2e0
        [cf35dcd0] [c0195348] nlmclnt_init+0x2c/0xc8
        [cf35dcf0] [c015bb5c] nfs_start_lockd+0x98/0xec
        [cf35dd20] [c015ce6c] nfs_create_server+0x1e8/0x3f4
        [cf35dd90] [c0171590] nfs3_create_server+0x10/0x44
        [cf35dda0] [c016528c] nfs_try_mount+0x158/0x1e4
        [cf35de20] [c01670d0] nfs_fs_mount+0x434/0x8c8
        [cf35de70] [c00cd3bc] mount_fs+0x20/0xbc
        [cf35de90] [c00e4f88] vfs_kern_mount+0x50/0x104
        [cf35dec0] [c00e6e0c] do_mount+0x1d0/0x8e0
        [cf35df10] [c00e75ac] SyS_mount+0x90/0xd0
        [cf35df40] [c000ccf4] ret_from_syscall+0x0/0x3c
      
      The addition of svc_shutdown_net() resulted in two calls to
      svc_rpcb_cleanup(); the second is no longer necessary and crashes when
      it calls rpcb_register_call with clnt=NULL.
      Reported-by: default avatarNikita Yushchenko <nyushchenko@dev.rtsoft.ru>
      Fixes: 679b033d "lockd: ensure we tear down any live sockets when socket creation fails during lockd_up"
      Cc: stable@vger.kernel.org
      Acked-by: default avatarJeff Layton <jlayton@primarydata.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      
      (cherry picked from commit 7c17705e)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      39c3e370
    • Larry Finger's avatar
      rtlwifi: rtl8192cu: Add new ID · 1acfa1fa
      Larry Finger authored
      The Sitecom WLA-2102 adapter uses this driver.
      Reported-by: default avatarNico Baggus <nico-linux@noci.xs4all.nl>
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Nico Baggus <nico-linux@noci.xs4all.nl>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit c6651716)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1acfa1fa
    • Tejun Heo's avatar
      percpu: perform tlb flush after pcpu_map_pages() failure · f8e97f7b
      Tejun Heo authored
      If pcpu_map_pages() fails midway, it unmaps the already mapped pages.
      Currently, it doesn't flush tlb after the partial unmapping.  This may
      be okay in most cases as the established mapping hasn't been used at
      that point but it can go wrong and when it goes wrong it'd be
      extremely difficult to track down.
      
      Flush tlb after the partial unmapping.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 849f5169)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f8e97f7b
    • Tejun Heo's avatar
      percpu: fix pcpu_alloc_pages() failure path · 144319ad
      Tejun Heo authored
      When pcpu_alloc_pages() fails midway, pcpu_free_pages() is invoked to
      free what has already been allocated.  The invocation is across the
      whole requested range and pcpu_free_pages() will try to free all
      non-NULL pages; unfortunately, this is incorrect as
      pcpu_get_pages_and_bitmap(), unlike what its comment suggests, doesn't
      clear the pages array and thus the array may have entries from the
      previous invocations making the partial failure path free incorrect
      pages.
      
      Fix it by open-coding the partial freeing of the already allocated
      pages.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit f0d27965)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      144319ad
    • Honggang Li's avatar
      Revert "percpu: free percpu allocation info for uniprocessor system" · de431443
      Honggang Li authored
      This reverts commit 3189eddb ("percpu: free percpu allocation info for
      uniprocessor system").
      
      The commit causes a hang with a crisv32 image. This may be an architecture
      problem, but at least for now the revert is necessary to be able to boot a
      crisv32 image.
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Honggang Li <enjoymindful@gmail.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Fixes: 3189eddb ("percpu: free percpu allocation info for uniprocessor system")
      Cc: stable@vger.kernel.org # Please don't apply 3189eddb
      
      percpu-refcount: make percpu_ref based on longs instead of ints
      
      percpu_ref is currently based on ints and the number of refs it can
      cover is (1 << 31).  This makes it impossible to use a percpu_ref to
      count memory objects or pages on 64bit machines as it may overflow.
      This forces those users to somehow aggregate the references before
      contributing to the percpu_ref which is often cumbersome and sometimes
      challenging to get the same level of performance as using the
      percpu_ref directly.
      
      While using ints for the percpu counters makes them pack tighter on
      64bit machines, the possible gain from using ints instead of longs is
      extremely small compared to the overall gain from per-cpu operation.
      This patch makes percpu_ref based on longs so that it can be used to
      directly count memory objects or pages.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      
      percpu-refcount: improve WARN messages
      
      percpu_ref's WARN messages can be a lot more helpful by indicating
      who's the culprit.  Make them report the release function that the
      offending percpu-refcount is associated with.  This should make it a
      lot easier to track down the reported invalid refcnting operations.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Kent Overstreet <kmo@daterainc.com>
      
      percpu: fix locking regression in the failure path of pcpu_alloc()
      
      While updating locking, b38d08f3 ("percpu: restructure locking")
      broke pcpu_create_chunk() creation path in pcpu_alloc().  It returns
      without releasing pcpu_alloc_mutex.  Fix it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
      
      percpu-refcount: add @gfp to percpu_ref_init()
      
      Percpu allocator now supports allocation mask.  Add @gfp to
      percpu_ref_init() so that !GFP_KERNEL allocation masks can be used
      with percpu_refs too.
      
      This patch doesn't make any functional difference.
      
      v2: blk-mq conversion was missing.  Updated.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Kent Overstreet <koverstreet@google.com>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      
      proportions: add @gfp to init functions
      
      Percpu allocator now supports allocation mask.  Add @gfp to
      [flex_]proportions init functions so that !GFP_KERNEL allocation masks
      can be used with them too.
      
      This patch doesn't make any functional difference.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      
      percpu_counter: add @gfp to percpu_counter_init()
      
      Percpu allocator now supports allocation mask.  Add @gfp to
      percpu_counter_init() so that !GFP_KERNEL allocation masks can be used
      with percpu_counters too.
      
      We could have left percpu_counter_init() alone and added
      percpu_counter_init_gfp(); however, the number of users isn't that
      high and introducing _gfp variants to all percpu data structures would
      be quite ugly, so let's just do the conversion.  This is the one with
      the most users.  Other percpu data structures are a lot easier to
      convert.
      
      This patch doesn't make any functional difference.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarJan Kara <jack@suse.cz>
      Acked-by: default avatar"David S. Miller" <davem@davemloft.net>
      Cc: x86@kernel.org
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      
      percpu_counter: make percpu_counters_lock irq-safe
      
      percpu_counter is scheduled to grow @gfp support to allow atomic
      initialization.  This patch makes percpu_counters_lock irq-safe so
      that it can be safely used from atomic contexts.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: implement asynchronous chunk population
      
      The percpu allocator now supports atomic allocations by only
      allocating from already populated areas but the mechanism to ensure
      that there's adequate amount of populated areas was missing.
      
      This patch expands pcpu_balance_work so that in addition to freeing
      excess free chunks it also populates chunks to maintain an adequate
      level of populated areas.  pcpu_alloc() schedules pcpu_balance_work if
      the amount of free populated areas is too low or after an atomic
      allocation failure.
      
      * PERPCU_DYNAMIC_RESERVE is increased by two pages to account for
        PCPU_EMPTY_POP_PAGES_LOW.
      
      * pcpu_async_enabled is added to gate both async jobs -
        chunk->map_extend_work and pcpu_balance_work - so that we don't end
        up scheduling them while the needed subsystems aren't up yet.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: rename pcpu_reclaim_work to pcpu_balance_work
      
      pcpu_reclaim_work will also be used to populate chunks asynchronously.
      Rename it to pcpu_balance_work in preparation.  pcpu_reclaim() is
      renamed to pcpu_balance_workfn() and some of its local variables are
      renamed too.
      
      This is pure rename.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: implmeent pcpu_nr_empty_pop_pages and chunk->nr_populated
      
      pcpu_nr_empty_pop_pages counts the number of empty populated pages
      across all chunks and chunk->nr_populated counts the number of
      populated pages in a chunk.  Both will be used to implement pre/async
      population for atomic allocations.
      
      pcpu_chunk_[de]populated() are added to update chunk->populated,
      chunk->nr_populated and pcpu_nr_empty_pop_pages together.  All
      successful chunk [de]populations should be followed by the
      corresponding pcpu_chunk_[de]populated() calls.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: make sure chunk->map array has available space
      
      An allocation attempt may require extending chunk->map array which
      requires GFP_KERNEL context which isn't available for atomic
      allocations.  This patch ensures that chunk->map array usually keeps
      some amount of available space by directly allocating buffer space
      during GFP_KERNEL allocations and scheduling async extension during
      atomic ones.  This should make atomic allocation failures from map
      space exhaustion rare.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: implement [__]alloc_percpu_gfp()
      
      Now that pcpu_alloc_area() can allocate only from populated areas,
      it's easy to add atomic allocation support to [__]alloc_percpu().
      Update pcpu_alloc() so that it accepts @gfp and skips all the blocking
      operations and allocates only from the populated areas if @gfp doesn't
      contain GFP_KERNEL.  New interface functions [__]alloc_percpu_gfp()
      are added.
      
      While this means that atomic allocations are possible, this isn't
      complete yet as there's no mechanism to ensure that certain amount of
      populated areas is kept available and atomic allocations may keep
      failing under certain conditions.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: indent the population block in pcpu_alloc()
      
      The next patch will conditionalize the population block in
      pcpu_alloc() which will end up making a rather large indentation
      change obfuscating the actual logic change.  This patch puts the block
      under "if (true)" so that the next patch can avoid indentation
      changes.  The defintions of the local variables which are used only in
      the block are moved into the block.
      
      This patch is purely cosmetic.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: make pcpu_alloc_area() capable of allocating only from populated areas
      
      Update pcpu_alloc_area() so that it can skip unpopulated areas if the
      new parameter @pop_only is true.  This is implemented by a new
      function, pcpu_fit_in_area(), which determines the amount of head
      padding considering the alignment and populated state.
      
      @pop_only is currently always false but this will be used to implement
      atomic allocation.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: restructure locking
      
      At first, the percpu allocator required a sleepable context for both
      alloc and free paths and used pcpu_alloc_mutex to protect everything.
      Later, pcpu_lock was introduced to protect the index data structure so
      that the free path can be invoked from atomic contexts.  The
      conversion only updated what's necessary and left most of the
      allocation path under pcpu_alloc_mutex.
      
      The percpu allocator is planned to add support for atomic allocation
      and this patch restructures locking so that the coverage of
      pcpu_alloc_mutex is further reduced.
      
      * pcpu_alloc() now grab pcpu_alloc_mutex only while creating a new
        chunk and populating the allocated area.  Everything else is now
        protected soley by pcpu_lock.
      
        After this change, multiple instances of pcpu_extend_area_map() may
        race but the function already implements sufficient synchronization
        using pcpu_lock.
      
        This also allows multiple allocators to arrive at new chunk
        creation.  To avoid creating multiple empty chunks back-to-back, a
        new chunk is created iff there is no other empty chunk after
        grabbing pcpu_alloc_mutex.
      
      * pcpu_lock is now held while modifying chunk->populated bitmap.
        After this, all data structures are protected by pcpu_lock.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: make percpu-km set chunk->populated bitmap properly
      
      percpu-km instantiates the whole chunk on creation and doesn't make
      use of chunk->populated bitmap and leaves it as zero.  While this
      currently doesn't cause any problem, the inconsistency makes it
      difficult to build further logic on top of chunk->populated.  This
      patch makes percpu-km fill chunk->populated on creation so that the
      bitmap is always consistent.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      
      percpu: move region iterations out of pcpu_[de]populate_chunk()
      
      Previously, pcpu_[de]populate_chunk() were called with the range which
      may contain multiple target regions in it and
      pcpu_[de]populate_chunk() iterated over the regions.  This has the
      benefit of batching up cache flushes for all the regions; however,
      we're planning to add more bookkeeping logic around [de]population to
      support atomic allocations and this delegation of iterations gets in
      the way.
      
      This patch moves the region iterations out of
      pcpu_[de]populate_chunk() into its callers - pcpu_alloc() and
      pcpu_reclaim() - so that we can later add logic to track more states
      around them.  This change may make cache and tlb flushes more frequent
      but multi-region [de]populations are rare anyway and if this actually
      becomes a problem, it's not difficult to factor out cache flushes as
      separate callbacks which are directly invoked from percpu.c.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: move common parts out of pcpu_[de]populate_chunk()
      
      percpu-vm and percpu-km implement separate versions of
      pcpu_[de]populate_chunk() and some part which is or should be common
      are currently in the specific implementations.  Make the following
      changes.
      
      * Allocate area clearing is moved from the pcpu_populate_chunk()
        implementations to pcpu_alloc().  This makes percpu-km's version
        noop.
      
      * Quick exit tests in pcpu_[de]populate_chunk() of percpu-vm are moved
        to their respective callers so that they are applied to percpu-km
        too.  This doesn't make any meaningful difference as both functions
        are noop for percpu-km; however, this is more consistent and will
        help implementing atomic allocation support.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: remove @may_alloc from pcpu_get_pages()
      
      pcpu_get_pages() creates the temp pages array if not already allocated
      and returns the pointer to it.  As the function is called from both
      [de]population paths and depopulation can only happen after at least
      one successful population, the param doesn't make any difference - the
      allocation will always happen on the population path anyway.
      
      Remove @may_alloc from pcpu_get_pages().  Also, add an lockdep
      assertion pcpu_alloc_mutex instead of vaguely stating that the
      exclusion is the caller's responsibility.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      percpu: remove the usage of separate populated bitmap in percpu-vm
      
      percpu-vm uses pcpu_get_pages_and_bitmap() to acquire temp pages array
      and populated bitmap and uses the two during [de]population.  The temp
      bitmap is used only to build the new bitmap that is copied to
      chunk->populated after the operation succeeds; however, the new bitmap
      can be trivially set after success without using the temp bitmap.
      
      This patch removes the temp populated bitmap usage from percpu-vm.c.
      
      * pcpu_get_pages_and_bitmap() is renamed to pcpu_get_pages() and no
        longer hands out the temp bitmap.
      
      * @populated arugment is dropped from all the related functions.
        @populated updates in pcpu_[un]map_pages() are dropped.
      
      * Two loops in pcpu_map_pages() are merged.
      
      * pcpu_[de]populated_chunk() modify chunk->populated bitmap directly
        from @page_start and @page_end after success.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      
      percpu: free percpu allocation info for uniprocessor system
      
      Currently, only SMP system free the percpu allocation info.
      Uniprocessor system should free it too. For example, one x86 UML
      virtual machine with 256MB memory, UML kernel wastes one page memory.
      Signed-off-by: default avatarHonggang Li <enjoymindful@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit bb2e226b
      3189eddb)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      de431443
    • James Ralston's avatar
      ata_piix: Add Device IDs for Intel 9 Series PCH · 8f5fbfbe
      James Ralston authored
      This patch adds the IDE mode SATA Device IDs for the Intel 9 Series PCH.
      Signed-off-by: default avatarJames Ralston <james.d.ralston@intel.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 6cad1376)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8f5fbfbe
    • Hans de Goede's avatar
      Input: i8042 - add nomux quirk for Avatar AVIU-145A6 · 1f1f580c
      Hans de Goede authored
      The sys_vendor / product_name are somewhat generic unfortunately, so this
      may lead to some false positives. But nomux usually does no harm, where as
      not having it clearly is causing problems on the Avatar AVIU-145A6.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=77391
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarHugo P <saurosii@gmail.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit d2682118)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1f1f580c
    • Hans de Goede's avatar
      4e2064c3
    • Hans de Goede's avatar
      Input: elantech - fix detection of touchpad on ASUS s301l · 64424c39
      Hans de Goede authored
      Adjust Elantech signature validation to account fo rnewer models of
      touchpads.
      
      Cc: stable@vger.kernel.org
      Reported-and-tested-by: default avatarMàrius Monton <marius.monton@gmail.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit 271329b3)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      64424c39
    • Dmitry Torokhov's avatar
      Input: synaptics - add support for ForcePads · 3933cff3
      Dmitry Torokhov authored
      ForcePads are found on HP EliteBook 1040 laptops. They lack any kind of
      physical buttons, instead they generate primary button click when user
      presses somewhat hard on the surface of the touchpad. Unfortunately they
      also report primary button click whenever there are 2 or more contacts
      on the pad, messing up all multi-finger gestures (2-finger scrolling,
      multi-finger tapping, etc). To cope with this behavior we introduce a
      delay (currently 50 msecs) in reporting primary press in case more
      contacts appear.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit 5715fc76)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3933cff3
    • John Sung's avatar
      Input: serport - add compat handling for SPIOCSTYPE ioctl · b08f6653
      John Sung authored
      When running a 32-bit inputattach utility in a 64-bit system, there will be
      error code "inputattach: can't set device type". This is caused by the
      serport device driver not supporting compat_ioctl, so that SPIOCSTYPE ioctl
      fails.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohn Sung <penmount.touch@gmail.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      
      (cherry picked from commit a80d8b02)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b08f6653
    • Mikulas Patocka's avatar
      dm crypt: fix access beyond the end of allocated space · b82708e5
      Mikulas Patocka authored
      The DM crypt target accesses memory beyond allocated space resulting in
      a crash on 32 bit x86 systems.
      
      This bug is very old (it dates back to 2.6.25 commit 3a7f6c99 "dm
      crypt: use async crypto").  However, this bug was masked by the fact
      that kmalloc rounds the size up to the next power of two.  This bug
      wasn't exposed until 3.17-rc1 commit 298a9fa0 ("dm crypt: use per-bio
      data").  By switching to using per-bio data there was no longer any
      padding beyond the end of a dm-crypt allocated memory block.
      
      To minimize allocation overhead dm-crypt puts several structures into one
      block allocated with kmalloc.  The block holds struct ablkcipher_request,
      cipher-specific scratch pad (crypto_ablkcipher_reqsize(any_tfm(cc))),
      struct dm_crypt_request and an initialization vector.
      
      The variable dmreq_start is set to offset of struct dm_crypt_request
      within this memory block.  dm-crypt allocates the block with this size:
      cc->dmreq_start + sizeof(struct dm_crypt_request) + cc->iv_size.
      
      When accessing the initialization vector, dm-crypt uses the function
      iv_of_dmreq, which performs this calculation: ALIGN((unsigned long)(dmreq
      + 1), crypto_ablkcipher_alignmask(any_tfm(cc)) + 1).
      
      dm-crypt allocated "cc->iv_size" bytes beyond the end of dm_crypt_request
      structure.  However, when dm-crypt accesses the initialization vector, it
      takes a pointer to the end of dm_crypt_request, aligns it, and then uses
      it as the initialization vector.  If the end of dm_crypt_request is not
      aligned on a crypto_ablkcipher_alignmask(any_tfm(cc)) boundary the
      alignment causes the initialization vector to point beyond the allocated
      space.
      
      Fix this bug by calculating the variable iv_size_padding and adding it
      to the allocated size.
      
      Also correct the alignment of dm_crypt_request.  struct dm_crypt_request
      is specific to dm-crypt (it isn't used by the crypto subsystem at all),
      so it is aligned on __alignof__(struct dm_crypt_request).
      
      Also align per_bio_data_size on ARCH_KMALLOC_MINALIGN, so that it is
      aligned as if the block was allocated with kmalloc.
      Reported-by: default avatarKrzysztof Kolasa <kkolasa@winsoft.pl>
      Tested-by: default avatarMilan Broz <gmazyland@gmail.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      
      (cherry picked from commit d49ec52f)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b82708e5
    • Thomas Gleixner's avatar
      futex: Unlock hb->lock in futex_wait_requeue_pi() error path · 1f2b2863
      Thomas Gleixner authored
      futex_wait_requeue_pi() calls futex_wait_setup(). If
      futex_wait_setup() succeeds it returns with hb->lock held and
      preemption disabled. Now the sanity check after this does:
      
              if (match_futex(&q.key, &key2)) {
      	   	ret = -EINVAL;
      		goto out_put_keys;
      	}
      
      which releases the keys but does not release hb->lock.
      
      So we happily return to user space with hb->lock held and therefor
      preemption disabled.
      
      Unlock hb->lock before taking the exit route.
      Reported-by: default avatarDave "Trinity" Jones <davej@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1409112318500.4178@nanosSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      
      (cherry picked from commit 13c42c2f)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1f2b2863
    • Mike Christie's avatar
      SCSI: libiscsi: fix potential buffer overrun in __iscsi_conn_send_pdu · e21622dc
      Mike Christie authored
      commit db9bfd64 upstream.
      
      This patches fixes a potential buffer overrun in __iscsi_conn_send_pdu.
      This function is used by iscsi drivers and userspace to send iscsi PDUs/
      commands. For login commands, we have a set buffer size. For all other
      commands we do not support data buffers.
      
      This was reported by Dan Carpenter here:
      http://www.spinics.net/lists/linux-scsi/msg66838.htmlReported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 8e36f1f3)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e21622dc
    • Nicholas Bellinger's avatar
      iscsi-target: Fix memory corruption in iscsit_logout_post_handler_diffcid · c7a5735f
      Nicholas Bellinger authored
      This patch fixes a bug in iscsit_logout_post_handler_diffcid() where
      a pointer used as storage for list_for_each_entry() was incorrectly
      being used to determine if no matching entry had been found.
      
      This patch changes iscsit_logout_post_handler_diffcid() to key off
      bool conn_found to determine if the function needs to exit early.
      Reported-by: default avatarJoern Engel <joern@logfs.org>
      Cc: <stable@vger.kernel.org> # v3.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      
      (cherry picked from commit b53b0d99)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      c7a5735f
    • Joern Engel's avatar
      iscsi-target: avoid NULL pointer in iscsi_copy_param_list failure · 642b393f
      Joern Engel authored
      In iscsi_copy_param_list() a failed iscsi_param_list memory allocation
      currently invokes iscsi_release_param_list() to cleanup, and will promptly
      trigger a NULL pointer dereference.
      
      Instead, go ahead and return for the first iscsi_copy_param_list()
      failure case.
      
      Found by coverity.
      Signed-off-by: default avatarJoern Engel <joern@logfs.org>
      Cc: <stable@vger.kernel.org> # v3.1+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      
      (cherry picked from commit 8ae757d0)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      642b393f
    • Srinivas Pandruvada's avatar
      iio: adc: ad_sigma_delta: Fix indio_dev->trig assignment · 88003122
      Srinivas Pandruvada authored
      This can result in wrong reference count for trigger device, call
      iio_trigger_get to increment reference.
      Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion
      with Jonathan.
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Cc: Stable@vger.kernel.org
      
      (cherry picked from commit 9e5846be)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      88003122
    • Srinivas Pandruvada's avatar
      iio: meter: ade7758: Fix indio_dev->trig assignment · f31af3da
      Srinivas Pandruvada authored
      This can result in wrong reference count for trigger device, call
      iio_trigger_get to increment reference.
      Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion
      with Jonathan.
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Cc: Stable@vger.kernel.org
      
      (cherry picked from commit 04950811)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f31af3da
    • Srinivas Pandruvada's avatar
      iio:trigger: modify return value for iio_trigger_get · 99d1e571
      Srinivas Pandruvada authored
      Instead of a void function, return the trigger pointer.
      
      Whilst not in of itself a fix, this makes the following set of
      7 fixes cleaner than they would otherwise be.
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Cc: Stable@vger.kernel.org
      
      (cherry picked from commit f1535665)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      99d1e571
    • Miklos Szeredi's avatar
      shmem: fix nlink for rename overwrite directory · 93b126fe
      Miklos Szeredi authored
      If overwriting an empty directory with rename, then need to drop the extra
      nlink.
      
      Test prog:
      
      #include <stdio.h>
      #include <fcntl.h>
      #include <err.h>
      #include <sys/stat.h>
      
      int main(void)
      {
      	const char *test_dir1 = "test-dir1";
      	const char *test_dir2 = "test-dir2";
      	int res;
      	int fd;
      	struct stat statbuf;
      
      	res = mkdir(test_dir1, 0777);
      	if (res == -1)
      		err(1, "mkdir(\"%s\")", test_dir1);
      
      	res = mkdir(test_dir2, 0777);
      	if (res == -1)
      		err(1, "mkdir(\"%s\")", test_dir2);
      
      	fd = open(test_dir2, O_RDONLY);
      	if (fd == -1)
      		err(1, "open(\"%s\")", test_dir2);
      
      	res = rename(test_dir1, test_dir2);
      	if (res == -1)
      		err(1, "rename(\"%s\", \"%s\")", test_dir1, test_dir2);
      
      	res = fstat(fd, &statbuf);
      	if (res == -1)
      		err(1, "fstat(%i)", fd);
      
      	if (statbuf.st_nlink != 0) {
      		fprintf(stderr, "nlink is %lu, should be 0\n", statbuf.st_nlink);
      		return 1;
      	}
      
      	return 0;
      }
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      
      (cherry picked from commit b928095b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      93b126fe
    • Dave Young's avatar
      x86 early_ioremap: Increase FIX_BTMAPS_SLOTS to 8 · 6395f387
      Dave Young authored
      3.16 kernel boot fail with earlyprintk=efi, it keeps scrolling at the
      bottom line of screen.
      
      Bisected, the first bad commit is below:
      commit 86dfc6f3
      Author: Lv Zheng <lv.zheng@intel.com>
      Date:   Fri Apr 4 12:38:57 2014 +0800
      
          ACPICA: Tables: Fix table checksums verification before installation.
      
      I did some debugging by enabling both serial and efi earlyprintk, below is
      some debug dmesg, seems early_ioremap fails in scroll up function due to
      no free slot, see below dmesg output:
      
        WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:116 __early_ioremap+0x90/0x1c4()
        __early_ioremap(ed00c800, 00000c80) not found slot
        Modules linked in:
        CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-rc1+ #204
        Hardware name: Hewlett-Packard HP Z420 Workstation/1589, BIOS J61 v03.15 05/09/2013
        Call Trace:
          dump_stack+0x4e/0x7a
          warn_slowpath_common+0x75/0x8e
          ? __early_ioremap+0x90/0x1c4
          warn_slowpath_fmt+0x47/0x49
          __early_ioremap+0x90/0x1c4
          ? sprintf+0x46/0x48
          early_ioremap+0x13/0x15
          early_efi_map+0x24/0x26
          early_efi_scroll_up+0x6d/0xc0
          early_efi_write+0x1b0/0x214
          call_console_drivers.constprop.21+0x73/0x7e
          console_unlock+0x151/0x3b2
          ? vprintk_emit+0x49f/0x532
          vprintk_emit+0x521/0x532
          ? console_unlock+0x383/0x3b2
          printk+0x4f/0x51
          acpi_os_vprintf+0x2b/0x2d
          acpi_os_printf+0x43/0x45
          acpi_info+0x5c/0x63
          ? __acpi_map_table+0x13/0x18
          ? acpi_os_map_iomem+0x21/0x147
          acpi_tb_print_table_header+0x177/0x186
          acpi_tb_install_table_with_override+0x4b/0x62
          acpi_tb_install_standard_table+0xd9/0x215
          ? early_ioremap+0x13/0x15
          ? __acpi_map_table+0x13/0x18
          acpi_tb_parse_root_table+0x16e/0x1b4
          acpi_initialize_tables+0x57/0x59
          acpi_table_init+0x50/0xce
          acpi_boot_table_init+0x1e/0x85
          setup_arch+0x9b7/0xcc4
          start_kernel+0x94/0x42d
          ? early_idt_handlers+0x120/0x120
          x86_64_start_reservations+0x2a/0x2c
          x86_64_start_kernel+0xf3/0x100
      
      Quote reply from Lv.zheng about the early ioremap slot usage in this case:
      
      """
      In early_efi_scroll_up(), 2 mapping entries will be used for the src/dst screen buffer.
      In drivers/acpi/acpica/tbutils.c, we've improved the early table loading code in acpi_tb_parse_root_table().
      We now need 2 mapping entries:
      1. One mapping entry is used for RSDT table mapping. Each RSDT entry contains an address for another ACPI table.
      2. For each entry in RSDP, we need another mapping entry to map the table to perform necessary check/override before installing it.
      
      When acpi_tb_parse_root_table() prints something through EFI earlyprintk console, we'll have 4 mapping entries used.
      The current 4 slots setting of early_ioremap() seems to be too small for such a use case.
      """
      
      Thus increase the slot to 8 in this patch to fix this issue.
      boot-time mappings become 512 page with this patch.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Cc: <stable@vger.kernel.org> # v3.16
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      
      (cherry picked from commit 3eddc69f)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6395f387
    • Ross Lagerwall's avatar
      xen/manage: Always freeze/thaw processes when suspend/resuming · 272a550c
      Ross Lagerwall authored
      Always freeze processes when suspending and thaw processes when resuming
      to prevent a race noticeable with HVM guests.
      
      This prevents a deadlock where the khubd kthread (which is designed to
      be freezable) acquires a usb device lock and then tries to allocate
      memory which requires the disk which hasn't been resumed yet.
      Meanwhile, the xenwatch thread deadlocks waiting for the usb device
      lock.
      
      Freezing processes fixes this because the khubd thread is only thawed
      after the xenwatch thread finishes resuming all the devices.
      Signed-off-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 61a734d3)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      272a550c
    • Mark Brown's avatar
      regmap: Fix handling of volatile registers for format_write() chips · 3ed37f45
      Mark Brown authored
      A previous over-zealous factorisation of code means that we only treat
      registers as volatile if they are readable. For most devices this is fine
      since normally most registers can be read and volatility implies
      readability but for format_write() devices where there is no readback from
      the hardware and we use volatility to mean simply uncacheability this means
      that we end up treating all registers as cacheble.
      
      A bigger refactoring of the code to clarify this is in order but as a fix
      make a minimal change and only check readability when checking volatility
      if there is no format_write() operation defined for the device.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Tested-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 5844a8b9)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3ed37f45
    • Lars-Peter Clausen's avatar
      regmap: Fix regcache debugfs initialization · bc22438e
      Lars-Peter Clausen authored
      Commit 6cfec04b ("regmap: Separate regmap dev initialization") moved the
      regmap debugfs initialization after regcache initialization. This means
      that the regmap debugfs directory is not created yet when the cache
      initialization runs and so any debugfs files registered by the regcache are
      created in the debugfs root directory rather than the debugfs directory of
      the regmap instance. Fix this by adding a separate callback for the
      regcache debugfs initialization which will be called after the parent
      debugfs entry has been created.
      
      Fixes: 6cfec04b (regmap: Separate regmap dev initialization)
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 5e0cbe78)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bc22438e
    • Aaron Lu's avatar
      ACPI / video: disable native backlight for ThinkPad X201s · 1134f90c
      Aaron Lu authored
      The ThinkPad X201s has a working ACPI video backlight interface and is
      shipped before Win8; then there is BIOS update that starts to query
      _OSI("Windows 2012") and that would make our video module stop creating
      backlight interface and caused problem for the user. Add it to the DMI
      table to disable native backlight to fix this problem.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=81691
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=51231
      Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
      Reported-and-tested-by: default avatarYves-Alexis Perez <corsac@debian.org>
      Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      
      (cherry picked from commit 789eeea1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      1134f90c
    • Bob Moore's avatar
      gpio / ACPI: Use pin index and bit length · d715fc9e
      Bob Moore authored
      Fix code when the operation region callback is for an gpio, which
      is not at index 0 and for partial pins in a GPIO definition.
      For example:
      Name (GMOD, ResourceTemplate ()
      {
      	//3 Outputs that define the Power mode of the device
      	GpioIo (Exclusive, PullDown, , , , "\\_SB.GPI2") {10, 11, 12}
      	})
      }
      
      If opregion callback calls is for:
      - Set pin 10, then address = 0 and bit length = 1
      - Set pin 11, then address = 1 and bit length = 1
      - Set for both pin 11 and pin 12, then address = 1, bit length = 2
      
      This change requires updated ACPICA gpio operation handler code to
      send the pin index and bit length.
      
      Fixes: 473ed7be (gpio / ACPI: Add support for ACPI GPIO operation regions)
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: 3.15+ <stable@vger.kernel.org> # 3.15+: 75ec6e55 ACPICA: Update to GPIO region handler interface.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      
      ACPICA: Update to GPIO region handler interface.
      
      Changes to correct several GPIO issues:
      
      1) The update_rule in a GPIO field definition is now ignored;
      a read-modify-write operation is never performed for GPIO fields.
      (Internally, this means that the field assembly/disassembly
      code is completely bypassed for GPIO.)
      
      2) The Address parameter passed to a GPIO region handler is
      now the bit offset of the field from a previous Connection()
      operator. Thus, it becomes a "Pin Number Index" into the
      Connection() resource descriptor.
      
      3) The bit_width parameter passed to a GPIO region handler is
      now the exact bit width of the GPIO field. Thus, it can be
      interpreted as "number of pins".
      
      Overall, we can now say that the region handler interface
      to GPIO handlers is a raw "bit/pin" addressed interface, not
      a byte-addressed interface like the system_memory handler interface.
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      
      (cherry picked from commit c15d821d
      75ec6e55)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d715fc9e
    • Markos Chandras's avatar
      MIPS: mcount: Adjust stack pointer for static trace in MIPS32 · 5a3d3dd5
      Markos Chandras authored
      Every mcount() call in the MIPS 32-bit kernel is done as follows:
      
      [...]
      move at, ra
      jal _mcount
      addiu sp, sp, -8
      [...]
      
      but upon returning from the mcount() function, the stack pointer
      is not adjusted properly. This is explained in details in 58b69401
      (MIPS: Function tracer: Fix broken function tracing).
      
      Commit ad8c3969 ("MIPS: Unbreak function tracer for 64-bit kernel.)
      fixed the stack manipulation for 64-bit but it didn't fix it completely
      for MIPS32.
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: <stable@vger.kernel.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7792/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      
      (cherry picked from commit 8a574cfa)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      5a3d3dd5
    • Aurelien Jarno's avatar
      MIPS: ZBOOT: add missing <linux/string.h> include · 4800fbb4
      Aurelien Jarno authored
      Commit dc4d7b37 (MIPS: ZBOOT: gather string functions into string.c)
      moved the string related functions into a separate file, which might
      cause the following build error, depending on the configuration:
      
      | CC      arch/mips/boot/compressed/decompress.o
      | In file included from linux/arch/mips/boot/compressed/../../../../lib/decompress_unxz.c:234:0,
      |                  from linux/arch/mips/boot/compressed/decompress.c:67:
      | linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_stream.c: In function 'fill_temp':
      | linux/arch/mips/boot/compressed/../../../../lib/xz/xz_dec_stream.c:162:2: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration]
      | cc1: some warnings being treated as errors
      | linux/scripts/Makefile.build:308: recipe for target 'arch/mips/boot/compressed/decompress.o' failed
      | make[6]: *** [arch/mips/boot/compressed/decompress.o] Error 1
      | linux/arch/mips/Makefile:308: recipe for target 'vmlinuz' failed
      
      It does not fail with the standard configuration, as when
      CONFIG_DYNAMIC_DEBUG is not enabled <linux/string.h> gets included in
      include/linux/dynamic_debug.h. There might be other ways for it to
      get indirectly included.
      
      We can't add the include directly in xz_dec_stream.c as some
      architectures might want to use a different version for the boot/
      directory (see for example arch/x86/boot/string.h).
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Cc: stable@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7420/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      
      (cherry picked from commit 29593fd5)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4800fbb4
    • Robin Murphy's avatar
      ARM: 8165/1: alignment: don't break misaligned NEON load/store · 2747dde6
      Robin Murphy authored
      The alignment fixup incorrectly decodes faulting ARM VLDn/VSTn
      instructions (where the optional alignment hint is given but incorrect)
      as LDR/STR, leading to register corruption. Detect these and correctly
      treat them as unhandled, so that userspace gets the fault it expects.
      Reported-by: default avatarSimon Hosie <simon.hosie@arm.com>
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      
      (cherry picked from commit 5ca918e5)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2747dde6
    • Sudeep Holla's avatar
      ARM: 8133/1: use irq_set_affinity with force=false when migrating irqs · f9ebecee
      Sudeep Holla authored
      Since commit 1dbfa187 ("ARM: irq migration: force migration off CPU
      going down") the ARM interrupt migration code on cpu offline calls
      irqchip.irq_set_affinity() with the argument force=true. At the point
      of this change the argument had no effect because it was not used by
      any interrupt chip driver and there was no semantics defined.
      
      This changed with commit 01f8fa4f ("genirq: Allow forcing cpu
      affinity of interrupts") which made the force argument useful to route
      interrupts to not yet online cpus without checking the target cpu
      against the cpu online mask. The following commit ffde1de6
      ("irqchip: gic: Support forced affinity setting") implemented this for
      the GIC interrupt controller.
      
      As a consequence the ARM cpu offline irq migration fails if CPU0 is
      offlined, because CPU0 is still set in the affinity mask and the
      validataion against cpu online mask is skipped to the force argument
      being true. The following first_cpu(mask) selection always selects
      CPU0 as the target.
      
      Solve the issue by calling irq_set_affinity() with force=false from
      the CPU offline irq migration code so the GIC driver validates the
      affinity mask against CPU online mask and therefore removes CPU0 from
      the possible target candidates.
      
      Tested on TC2 hotpluging CPU0 in and out. Without this patch the system
      locks up as the IRQs are not migrated away from CPU0.
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: <stable@vger.kernel.org> # 3.10.x
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      
      (cherry picked from commit a040803a)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f9ebecee
    • Steve Dickson's avatar
      NFSv4: nfs4_state_manager() vs. nfs_server_remove_lists() · dfa0d821
      Steve Dickson authored
      There is a race between nfs4_state_manager() and
      nfs_server_remove_lists() that happens during a nfsv3 mount.
      
      The v3 mount notices there is already a supper block so
      nfs_server_remove_lists() called which uses the nfs_client_lock
      spin lock to synchronize access to the client list.
      
      At the same time nfs4_state_manager() is running through
      the client list looking for work to do, using the same
      lock. When nfs4_state_manager() wins the race to the
      list, a v3 client pointer is found and not ignored
      properly which causes the panic.
      
      Moving some protocol checks before the state checking
      avoids the panic.
      
      CC: Stable Tree <stable@vger.kernel.org>
      Signed-off-by: default avatarSteve Dickson <steved@redhat.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      
      (cherry picked from commit 080af20c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      dfa0d821
    • Mark's avatar
      USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters · ce7c15a7
      Mark authored
      This patch adds quirks for Entrega Technologies (later Xircom PortGear) USB-
      SCSI converters. They use Shuttle Technology EUSB-01/EUSB-S1 chips. The
      US_FL_SCM_MULT_TARG quirk is needed to allow multiple devices on the SCSI
      chain to be accessed. Without it only the (single) device with SCSI ID 0
      can be used.
      
      The standalone converter sold by Entrega had model number U1-SC25. Xircom
      acquired Entrega and re-branded the product line PortGear. The PortGear USB
      to SCSI Converter (model PGSCSI) is internally identical to the Entrega
      product, but later models may use a different USB ID. The Entrega-branded
      units have USB ID 1645:0007, as does my Xircom PGSCSI, but the Windows and
      Macintosh drivers also support 085A:0028.
      
      Entrega also sold the "Mac USB Dock", which provides two USB ports, a Mac
      (8-pin mini-DIN) serial port and a SCSI port. It appears to the computer as
      a four-port hub, USB-serial, and USB-SCSI converters. The USB-SCSI part may
      have initially used the same ID as the standalone U1-SC25 (1645:0007), but
      later production used 085A:0026.
      
      My Xircom PortGear PGSCSI has bcdDevice=0x0100. Units with bcdDevice=0x0133
      probably also exist.
      
      This patch adds quirks for 1645:0007, 085A:0026 and 085A:0028. The Windows
      driver INF file also mentions 085A:0032 "PortStation SCSI Module", but I
      couldn't find any mention of that actually existing in the wild; perhaps it
      was cancelled before release?
      Signed-off-by: default avatarMark Knibbs <markk@clara.co.uk>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit c80b4495)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      ce7c15a7
    • Mark's avatar
      USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter · 0e99207b
      Mark authored
      Hi,
      
      The Ariston Technologies iConnect 025 and iConnect 050 (also known as e.g.
      iSCSI-50) are SCSI-USB converters which use Shuttle Technology/SCM
      Microsystems chips. Only the connectors differ; both have the same USB ID.
      The US_FL_SCM_MULT_TARG quirk is required to use SCSI devices with ID other
      than 0.
      
      I don't have one of these, but based on the other entries for Shuttle/
      SCM-based converters this patch is very likely correct. I used 0x0000 and
      0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which
      bcdDevice value the products use.
      Signed-off-by: default avatarMark Knibbs <markk@clara.co.uk>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit b6a3ed67)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0e99207b
    • Mark's avatar
      USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter · f4f42a02
      Mark authored
      The Adaptec USBConnect 2000 is another SCSI-USB converter which uses
      Shuttle Technology/SCM Microsystems chips. The US_FL_SCM_MULT_TARG quirk is
      required to use SCSI devices with ID other than 0.
      
      I don't have a USBConnect 2000, but based on the other entries for Shuttle/
      SCM-based converters this patch is very likely correct. I used 0x0000 and
      0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which
      bcdDevice value the product uses.
      Signed-off-by: default avatarMark Knibbs <markk@clara.co.uk>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 67d365a5)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      f4f42a02
    • Mark's avatar
      storage: Add single-LUN quirk for Jaz USB Adapter · 2188debb
      Mark authored
      The Iomega Jaz USB Adapter is a SCSI-USB converter cable. The hardware
      seems to be identical to e.g. the Microtech XpressSCSI, using a Shuttle/
      SCM chip set. However its firmware restricts it to only work with Jaz
      drives.
      
      On connecting the cable a message like this appears four times in the log:
       reset full speed USB device number 4 using uhci_hcd
      
      That's non-fatal but the US_FL_SINGLE_LUN quirk fixes it.
      Signed-off-by: default avatarMark Knibbs <markk@clara.co.uk>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit c66f1c62)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      2188debb
    • Alan Stern's avatar
      USB: document the 'u' flag for usb-storage quirks parameter · 3fad285d
      Alan Stern authored
      Commit d24d481b (usb-storage: Modify and export adjust_quirks so
      that it can be used by uas) added the 'u' flag to the quirks module
      parameter for usb-storage, but neglected to update the
      documentation.  This patch adds the documentation.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>  # 3.15+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit b6089f19)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3fad285d
    • Joe Lawrence's avatar
      usb: hub: take hub->hdev reference when processing from eventlist · 6015907b
      Joe Lawrence authored
      commit c605f3cd upstream.
      
      During surprise device hotplug removal tests, it was observed that
      hub_events may try to call usb_lock_device on a device that has already
      been freed. Protect the usb_device by taking out a reference (under the
      hub_event_lock) when hub_events pulls it off the list, returning the
      reference after hub_events is finished using it.
      Signed-off-by: default avatarJoe Lawrence <joe.lawrence@stratus.com>
      Suggested-by: David Bulkow <david.bulkow@stratus.com> for using kref
      Suggested-by: Alan Stern <stern@rowland.harvard.edu> for placement
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      (cherry picked from commit 3b16693f)
      6015907b