07 Jul, 2014

27 commits

  • commit 8ec0a0e6b58218bdc1db91dd70ebfcd6ad8dd6cd upstream.

    Avoid leaking a kref count in ib_umad_open() if port->ib_dev == NULL
    or if nonseekable_open() fails.

    Avoid leaking a kref count, that sm_sem is kept down and also that the
    IB_PORT_SM capability mask is not cleared in ib_umad_sm_open() if
    nonseekable_open() fails.

    Since container_of() never returns NULL, remove the code that tests
    whether container_of() returns NULL.

    Moving the kref_get() call from the start of ib_umad_*open() to the
    end is safe since it is the responsibility of the caller of these
    functions to ensure that the cdev pointer remains valid until at least
    when these functions return.

    Signed-off-by: Bart Van Assche

    [ydroneaud@opteya.com: rework a bit to reduce the amount of code changed]

    Signed-off-by: Yann Droneaud

    [ nonseekable_open() can't actually fail, but.... - Roland ]

    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Bart Van Assche
     
  • commit 024ca90151f5e4296d30f72c13ff9a075e23c9ec upstream.

    Avoid that the loops that iterate over the request ring can encounter
    a pointer to a SCSI command in req->scmnd that is no longer associated
    with that request. If the function srp_unmap_data() is invoked twice
    for a SCSI command that is not in flight then that would cause
    ib_fmr_pool_unmap() to be invoked with an invalid pointer as argument,
    resulting in a kernel oops.

    Reported-by: Sagi Grimberg
    Reference: http://thread.gmane.org/gmane.linux.drivers.rdma/19068/focus=19069
    Signed-off-by: Bart Van Assche
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Bart Van Assche
     
  • commit 7e6d3e5c70f13874fb06e6b67696ed90ce79bd48 upstream.

    This patch addresses an issue where the legacy diagpacket is sent in
    from the user, but the driver operates on only the extended
    diagpkt. This patch specifically initializes the extended diagpkt
    based on the legacy packet.

    Reported-by: Rickard Strandqvist
    Reviewed-by: Mike Marciniszyn
    Signed-off-by: Dennis Dalessandro
    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Dennis Dalessandro
     
  • commit 911eccd284d13d78c92ec4f1f1092c03457d732a upstream.

    The code used a literal 1 in dispatching an IB_EVENT_PKEY_CHANGE.

    As of the dual port qib QDR card, this is not necessarily correct.

    Change to use the port as specified in the call.

    Reported-by: Alex Estrin
    Reviewed-by: Dennis Dalessandro
    Signed-off-by: Mike Marciniszyn
    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Mike Marciniszyn
     
  • commit 43bc889380c2ad9aa230eccc03a15cc52cf710d4 upstream.

    The i386 ABI disagrees with most other ABIs regarding alignment of
    data type larger than 4 bytes: on most ABIs a padding must be added at
    end of the structures, while it is not required on i386.

    So for most ABIs struct mlx5_ib_create_srq gets implicitly padded to be
    aligned on a 8 bytes multiple, while for i386, such padding is not
    added.

    Tool pahole could be used to find such implicit padding:

    $ pahole --anon_include \
    --nested_anon_include \
    --recursive \
    --class_name mlx5_ib_create_srq \
    drivers/infiniband/hw/mlx5/mlx5_ib.o

    Then, structure layout can be compared between i386 and x86_64:

    # +++ obj-i386/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-28 11:43:07.386413682 +0100
    # --- obj-x86_64/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-27 13:06:17.788472721 +0100
    # @@ -69,7 +68,6 @@ struct mlx5_ib_create_srq {
    # __u64 db_addr; /* 8 8 */
    # __u32 flags; /* 16 4 */
    #
    # - /* size: 20, cachelines: 1, members: 3 */
    # - /* last cacheline: 20 bytes */
    # + /* size: 24, cachelines: 1, members: 3 */
    # + /* padding: 4 */
    # + /* last cacheline: 24 bytes */
    # };

    ABI disagreement will make an x86_64 kernel try to read past
    the buffer provided by an i386 binary.

    When boundary check will be implemented, the x86_64 kernel will
    refuse to read past the i386 userspace provided buffer and the
    uverb will fail.

    Anyway, if the structure lay in memory on a page boundary and
    next page is not mapped, ib_copy_from_udata() will fail and the
    uverb will fail.

    This patch makes create_srq_user() takes care of the input
    data size to handle the case where no padding was provided.

    This way, x86_64 kernel will be able to handle struct mlx5_ib_create_srq
    as sent by unpatched and patched i386 libmlx5.

    Link: http://marc.info/?i=cover.1399309513.git.ydroneaud@opteya.com
    Fixes: e126ba97dba9e ("mlx5: Add driver for Mellanox Connect-IB adapter")
    Signed-off-by: Yann Droneaud
    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Yann Droneaud
     
  • commit a8237b32a3faab155a5dc8f886452147ce73da3e upstream.

    The i386 ABI disagrees with most other ABIs regarding alignment of
    data type larger than 4 bytes: on most ABIs a padding must be added at
    end of the structures, while it is not required on i386.

    So for most ABI struct mlx5_ib_create_cq get padded to be aligned on a
    8 bytes multiple, while for i386, such padding is not added.

    The tool pahole can be used to find such implicit padding:

    $ pahole --anon_include \
    --nested_anon_include \
    --recursive \
    --class_name mlx5_ib_create_cq \
    drivers/infiniband/hw/mlx5/mlx5_ib.o

    Then, structure layout can be compared between i386 and x86_64:

    # +++ obj-i386/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-28 11:43:07.386413682 +0100
    # --- obj-x86_64/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt 2014-03-27 13:06:17.788472721 +0100
    # @@ -34,9 +34,8 @@ struct mlx5_ib_create_cq {
    # __u64 db_addr; /* 8 8 */
    # __u32 cqe_size; /* 16 4 */
    #
    # - /* size: 20, cachelines: 1, members: 3 */
    # - /* last cacheline: 20 bytes */
    # + /* size: 24, cachelines: 1, members: 3 */
    # + /* padding: 4 */
    # + /* last cacheline: 24 bytes */
    # };

    This ABI disagreement will make an x86_64 kernel try to read past the
    buffer provided by an i386 binary.

    When boundary check will be implemented, a x86_64 kernel will refuse
    to read past the i386 userspace provided buffer and the uverb will
    fail.

    Anyway, if the structure lies in memory on a page boundary and next
    page is not mapped, ib_copy_from_udata() will fail when trying to read
    the 4 bytes of padding and the uverb will fail.

    This patch makes create_cq_user() takes care of the input data size to
    handle the case where no padding is provided.

    This way, x86_64 kernel will be able to handle struct
    mlx5_ib_create_cq as sent by unpatched and patched i386 libmlx5.

    Link: http://marc.info/?i=cover.1399309513.git.ydroneaud@opteya.com
    Fixes: e126ba97dba9e ("mlx5: Add driver for Mellanox Connect-IB adapter")
    Signed-off-by: Yann Droneaud
    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Yann Droneaud
     
  • commit bde92cf455a03a91badb7046855592d8c008e929 upstream.

    Peter Wu noticed the following splat on his machine when updating
    /proc/sys/kernel/watchdog_thresh:

    BUG: sleeping function called from invalid context at mm/slub.c:965
    in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: init
    3 locks held by init/1:
    #0: (sb_writers#3){.+.+.+}, at: [] vfs_write+0x143/0x180
    #1: (watchdog_proc_mutex){+.+.+.}, at: [] proc_dowatchdog+0x33/0x110
    #2: (cpu_hotplug.lock){.+.+.+}, at: [] get_online_cpus+0x32/0x80
    Preemption disabled at:[] proc_dowatchdog+0xe4/0x110

    CPU: 0 PID: 1 Comm: init Not tainted 3.16.0-rc1-testing #34
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    Call Trace:
    dump_stack+0x4e/0x7a
    __might_sleep+0x11d/0x190
    kmem_cache_alloc_trace+0x4e/0x1e0
    perf_event_alloc+0x55/0x440
    perf_event_create_kernel_counter+0x26/0xe0
    watchdog_nmi_enable+0x75/0x140
    update_timers_all_cpus+0x53/0xa0
    proc_dowatchdog+0xe4/0x110
    proc_sys_call_handler+0xb3/0xc0
    proc_sys_write+0x14/0x20
    vfs_write+0xad/0x180
    SyS_write+0x49/0xb0
    system_call_fastpath+0x16/0x1b
    NMI watchdog: disabled (cpu0): hardware events not enabled

    What happened is after updating the watchdog_thresh, the lockup detector
    is restarted to utilize the new value. Part of this process involved
    disabling preemption. Once preemption was disabled, perf tried to
    allocate a new event (as part of the restart). This caused the above
    BUG_ON as you can't sleep with preemption disabled.

    The preemption restriction seemed agressive as we are not doing anything
    on that particular cpu, but with all the online cpus (which are
    protected by the get_online_cpus lock). Remove the restriction and the
    BUG_ON goes away.

    Signed-off-by: Don Zickus
    Acked-by: Michal Hocko
    Reported-by: Peter Wu
    Tested-by: Peter Wu
    Acked-by: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Don Zickus
     
  • commit a9e0436b303e94ba57d3bd4b1fcbeaa744b7ebeb upstream.

    Use the prescaler index, rather than its value, to configure the watchdog.
    This will prevent a mismatch with the prescaler used to calculate the cycles.

    Signed-off-by: Per Gundberg
    Reviewed-by: Guenter Roeck
    Reviewed-by: Michael Brunner
    Tested-by: Michael Brunner
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    gundberg
     
  • commit 23afeb613ec0e10aecfae7838a14d485db62ac52 upstream.

    On some AR934x based systems, where the frequency of
    the AHB bus is relatively high, the built-in watchdog
    causes a spurious restart when it gets enabled.

    The possible cause of these restarts is that the timeout
    value written into the TIMER register does not reaches
    the hardware in time.

    Add an explicit delay into the ath79_wdt_enable function
    to avoid the spurious restarts.

    Signed-off-by: Gabor Juhos
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Gabor Juhos
     
  • commit 938626d96a3ffb9eb54552bb0d3a4f2b30ffdeb0 upstream.

    Implementation of ->set_timeout() is supposed to set 'timeout' field of 'struct
    watchdog_device' passed to it. sp805 was rather setting this in a local
    variable. Fix it.

    Reported-by: Arun Ramamurthy
    Signed-off-by: Viresh Kumar
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     
  • commit 72abc8f4b4e8574318189886de627a2bfe6cd0da upstream.

    I hit the same assert failed as Dolev Raviv reported in Kernel v3.10
    shows like this:

    [ 9641.164028] UBIFS assert failed in shrink_tnc at 131 (pid 13297)
    [ 9641.234078] CPU: 1 PID: 13297 Comm: mmap.test Tainted: G O 3.10.40 #1
    [ 9641.234116] [] (unwind_backtrace+0x0/0x12c) from [] (show_stack+0x20/0x24)
    [ 9641.234137] [] (show_stack+0x20/0x24) from [] (dump_stack+0x20/0x28)
    [ 9641.234188] [] (dump_stack+0x20/0x28) from [] (shrink_tnc_trees+0x25c/0x350 [ubifs])
    [ 9641.234265] [] (shrink_tnc_trees+0x25c/0x350 [ubifs]) from [] (ubifs_shrinker+0x25c/0x310 [ubifs])
    [ 9641.234307] [] (ubifs_shrinker+0x25c/0x310 [ubifs]) from [] (shrink_slab+0x1d4/0x2f8)
    [ 9641.234327] [] (shrink_slab+0x1d4/0x2f8) from [] (do_try_to_free_pages+0x300/0x544)
    [ 9641.234344] [] (do_try_to_free_pages+0x300/0x544) from [] (try_to_free_pages+0x2d0/0x398)
    [ 9641.234363] [] (try_to_free_pages+0x2d0/0x398) from [] (__alloc_pages_nodemask+0x494/0x7e8)
    [ 9641.234382] [] (__alloc_pages_nodemask+0x494/0x7e8) from [] (new_slab+0x78/0x238)
    [ 9641.234400] [] (new_slab+0x78/0x238) from [] (__slab_alloc.constprop.42+0x1a4/0x50c)
    [ 9641.234419] [] (__slab_alloc.constprop.42+0x1a4/0x50c) from [] (kmem_cache_alloc_trace+0x54/0x188)
    [ 9641.234459] [] (kmem_cache_alloc_trace+0x54/0x188) from [] (do_readpage+0x168/0x468 [ubifs])
    [ 9641.234553] [] (do_readpage+0x168/0x468 [ubifs]) from [] (ubifs_readpage+0x424/0x464 [ubifs])
    [ 9641.234606] [] (ubifs_readpage+0x424/0x464 [ubifs]) from [] (filemap_fault+0x304/0x418)
    [ 9641.234638] [] (filemap_fault+0x304/0x418) from [] (__do_fault+0xd4/0x530)
    [ 9641.234665] [] (__do_fault+0xd4/0x530) from [] (handle_pte_fault+0x480/0xf54)
    [ 9641.234690] [] (handle_pte_fault+0x480/0xf54) from [] (handle_mm_fault+0x140/0x184)
    [ 9641.234716] [] (handle_mm_fault+0x140/0x184) from [] (do_page_fault+0x150/0x3ac)
    [ 9641.234737] [] (do_page_fault+0x150/0x3ac) from [] (do_DataAbort+0x3c/0xa0)
    [ 9641.234759] [] (do_DataAbort+0x3c/0xa0) from [] (__dabt_usr+0x38/0x40)

    After analyzing the code, I found a condition that may cause this failed
    in correct operations. Thus, I think this assertion is wrong and should be
    removed.

    Suppose there are two clean znodes and one dirty znode in TNC. So the
    per-filesystem atomic_t @clean_zn_cnt is (2). If commit start, dirty_znode
    is set to COW_ZNODE in get_znodes_to_commit() in case of potentially ops
    on this znode. We clear COW bit and DIRTY bit in write_index() without
    @tnc_mutex locked. We don't increase @clean_zn_cnt in this place. As the
    comments in write_index() shows, if another process hold @tnc_mutex and
    dirty this znode after we clean it, @clean_zn_cnt would be decreased to (1).
    We will increase @clean_zn_cnt to (2) with @tnc_mutex locked in
    free_obsolete_znodes() to keep it right.

    If shrink_tnc() performs between decrease and increase, it will release
    other 2 clean znodes it holds and found @clean_zn_cnt is less than zero
    (1 - 2 = -1), then hit the assertion. Because free_obsolete_znodes() will
    soon correct @clean_zn_cnt and no harm to fs in this case, I think this
    assertion could be removed.

    2 clean zondes and 1 dirty znode, @clean_zn_cnt == 2

    Thread A (commit) Thread B (write or others) Thread C (shrinker)
    ->write_index
    ->clear_bit(DIRTY_NODE)
    ->clear_bit(COW_ZNODE)

    @clean_zn_cnt == 2
    ->mutex_locked(&tnc_mutex)
    ->dirty_cow_znode
    ->!ubifs_zn_cow(znode)
    ->!test_and_set_bit(DIRTY_NODE)
    ->atomic_dec(&clean_zn_cnt)
    ->mutex_unlocked(&tnc_mutex)

    @clean_zn_cnt == 1
    ->mutex_locked(&tnc_mutex)
    ->shrink_tnc
    ->destroy_tnc_subtree
    ->atomic_sub(&clean_zn_cnt, 2)
    ->ubifs_assert mutex_unlocked(&tnc_mutex)

    @clean_zn_cnt == -1
    ->mutex_lock(&tnc_mutex)
    ->free_obsolete_znodes
    ->atomic_inc(&clean_zn_cnt)
    ->mutux_unlock(&tnc_mutex)

    @clean_zn_cnt == 0 (correct after shrink)

    Signed-off-by: hujianyang
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Greg Kroah-Hartman

    hujianyang
     
  • commit 691a7c6f28ac90cccd0dbcf81348ea90b211bdd0 upstream.

    There is a race condition in UBIFS:

    Thread A (mmap) Thread B (fsync)

    ->__do_fault ->write_cache_pages
    -> ubifs_vm_page_mkwrite
    -> budget_space
    -> lock_page
    -> release/convert_page_budget
    -> SetPagePrivate
    -> TestSetPageDirty
    -> unlock_page
    -> lock_page
    -> TestClearPageDirty
    -> ubifs_writepage
    -> do_writepage
    -> release_budget
    -> ClearPagePrivate
    -> unlock_page
    -> !(ret & VM_FAULT_LOCKED)
    -> lock_page
    -> set_page_dirty
    -> ubifs_set_page_dirty
    -> TestSetPageDirty (set page dirty without budgeting)
    -> unlock_page

    This leads to situation where we have a diry page but no budget allocated for
    this page, so further write-back may fail with -ENOSPC.

    In this fix we return from page_mkwrite without performing unlock_page. We
    return VM_FAULT_LOCKED instead. After doing this, the race above will not
    happen.

    Signed-off-by: hujianyang
    Tested-by: Laurence Withers
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Greg Kroah-Hartman

    hujianyang
     
  • commit ab6c15bc6620ebe220970cc040b29bcb2757f373 upstream.

    Previously, the lower limit for the MIPS SC initialization loop was
    set incorrectly allowing one extra loop leading to writes
    beyond the MSC ioremap'd space. More precisely, the value of the 'imp'
    in the last loop increased beyond the msc_irqmap_t boundaries and
    as a result of which, the 'n' variable was loaded with an incorrect
    value. This value was used later on to calculate the offset in the
    MSC01_IC_SUP which led to random crashes like the following one:

    CPU 0 Unable to handle kernel paging request at virtual address e75c0200,
    epc == 8058dba4, ra == 8058db90
    [...]
    Call Trace:
    [] init_msc_irqs+0x104/0x154
    [] arch_init_irq+0xd8/0x154
    [] start_kernel+0x220/0x36c

    Kernel panic - not syncing: Attempted to kill the idle task!

    This patch fixes the problem

    Signed-off-by: Markos Chandras
    Reviewed-by: James Hogan
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/7118/
    Signed-off-by: Ralf Baechle
    Signed-off-by: Greg Kroah-Hartman

    Markos Chandras
     
  • commit 91ad11d7cc6f4472ebf177a6252fbf0fd100d798 upstream.

    On MIPS calls to _mcount in modules generate 2 instructions to load
    the _mcount address (and therefore 2 relocations). The mcount_loc
    table should only reference the first of these, so the second is
    filtered out by checking the relocation offset and ignoring ones that
    immediately follow the previous one seen.

    However if a module has an _mcount call at offset 0, the second
    relocation would not be filtered out due to old_r_offset == 0
    being taken to mean that the current relocation is the first one
    seen, and both would end up in the mcount_loc table.

    This results in ftrace_make_nop() patching both (adjacent)
    instructions to branches over the _mcount call sequence like so:

    0xffffffffc08a8000: 04 00 00 10 b 0xffffffffc08a8014
    0xffffffffc08a8004: 04 00 00 10 b 0xffffffffc08a8018
    0xffffffffc08a8008: 2d 08 e0 03 move at,ra
    ...

    The second branch is in the delay slot of the first, which is
    defined to be unpredictable - on the platform on which this bug was
    encountered, it triggers a reserved instruction exception.

    Fix by initializing old_r_offset to ~0 and using that instead of 0
    to determine whether the current relocation is the first seen.

    Signed-off-by: Alex Smith
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/7098/
    Signed-off-by: Ralf Baechle
    Signed-off-by: Greg Kroah-Hartman

    Alex Smith
     
  • commit af5ded8ccf21627f9614afc03b356712666ed225 upstream.

    In module exit, dfs_parent and it's subtree were removed before
    unregistering with pci. When debugfs entry for each device is attempted
    to remove in pci_remove() context, they don't exist, as dfs_parent and
    its children were already ripped apart.

    Modified to first unregister with pci and then remove dfs_parent.

    Signed-off-by: Asai Thambi S P
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Asai Thambi S P
     
  • commit 670a641420a3d9586eebe7429dfeec4e7ed447aa upstream.

    Increased timeout for STANDBY IMMEDIATE command to 2 minutes.

    Signed-off-by: Selvan Mani
    Signed-off-by: Asai Thambi S P
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Asai Thambi S P
     
  • commit d1e714db8129a1d3670e449b87719c78e2c76f9f upstream.

    A hardware quirk in P320h/P420m interfere with PCIe transactions on some
    AMD chipsets, making P320h/P420m unusable. This workaround is to disable
    ERO and NoSnoop bits in the parent and root complex for normal
    functioning of these devices

    NOTE: This workaround is specific to AMD chipset with a PCIe upstream
    device with device id 0x5aXX

    Signed-off-by: Asai Thambi S P
    Signed-off-by: Sam Bradshaw
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Asai Thambi S P
     
  • commit 67ebd8140dc8923c65451fa0f6a8eee003c4dcd3 upstream.

    3448a19da479 "vgaarb: use bridges to control VGA routing where possible"
    added the "flags & PCI_VGA_STATE_CHANGE_DECODES" condition to an existing
    WARN_ON(), but used bitwise AND (&) instead of logical AND (&&), so the
    condition is never true. Replace with logical AND.

    Found by Coverity (CID 142811).

    Fixes: 3448a19da479 "vgaarb: use bridges to control VGA routing where possible"
    Signed-off-by: Bjorn Helgaas
    Acked-by: Yinghai Lu
    Acked-by: David Airlie
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Helgaas
     
  • commit 7c82126a94e69bbbac586f0249e7ef11e681246c upstream.

    After a CPU upgrade while keeping the same mainboard, we faced "spurious
    interrupt" problems again.

    It turned out that the new CPU also featured a new GPU with a different PCI
    ID.

    Add this PCI ID to the quirk table. Probably all other Intel GPU PCI IDs
    are affected, too, but I don't want to add them without a test system.

    See f67fd55fa96f ("PCI: Add quirk for still enabled interrupts on Intel
    Sandy Bridge GPUs") for some history.

    [bhelgaas: add f67fd55fa96f reference, stable tag]
    Signed-off-by: Thomas Jarosch
    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Greg Kroah-Hartman

    Thomas Jarosch
     
  • commit fb4f8f568a9def02240ef9bf7aabd246dc63a081 upstream.

    The touchpad on the GIGABYTE U2442 not only stops communicating when we try
    to set bit 3 (enable real hardware resolution) of reg_10, but on some BIOS
    versions also when we set bit 1 (enable two finger mode auto correct).

    I've asked the original reporter of:
    https://bugzilla.kernel.org/show_bug.cgi?id=61151

    To check that not setting bit 1 does not lead to any adverse effects on his
    model / BIOS revision, and it does not, so this commit fixes the touchpad
    not working on these versions by simply never setting bit 1 for laptop
    models with the no_hw_res quirk.

    Reported-and-tested-by: James Lademann
    Tested-by: Philipp Wolfer
    Signed-off-by: Hans de Goede
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • commit cd9e83e2754465856097f31c7ab933ce74c473f8 upstream.

    At least the Dell Vostro 5470 elantech *clickpad* reports right button
    clicks when clicked in the right bottom area:

    https://bugzilla.redhat.com/show_bug.cgi?id=1103528

    This is different from how (elantech) clickpads normally operate, normally
    no matter where the user clicks on the pad the pad always reports a left
    button event, since there is only 1 hardware button beneath the path.

    It looks like Dell has put 2 buttons under the pad, one under each bottom
    corner, causing this.

    Since this however still clearly is a real clickpad hardware-wise, we still
    want to report it as such to userspace, so that things like finger movement
    in the bottom area can be properly ignored as it should be on clickpads.

    So deal with this weirdness by simply mapping a right click to a left click
    on elantech clickpads. As an added advantage this is something which we can
    simply do on all elantech clickpads, so no need to add special quirks for
    this weird model.

    Reported-and-tested-by: Elder Marco
    Signed-off-by: Hans de Goede
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • commit d49cb7aeebb974713f9f7ab2991352d3050b095b upstream.

    commit 421e08c41fda fixed the reported min/max for the X and Y axis,
    but unfortunately, it broke the resolution of those same axis.

    On the t540p, the resolution is the same regarding X and Y. It is not
    a problem for xf86-input-synaptics because this driver is only interested
    in the ratio between X and Y.
    Unfortunately, xf86-input-cmt uses directly the resolution, and having a
    null resolution leads to some divide by 0 errors, which are translated by
    -infinity in the resulting coordinates.

    Reported-by: Peter Hutterer
    Signed-off-by: Benjamin Tissoires
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Benjamin Tissoires
     
  • commit 81a9c5e72bdf7109a65102ca61d8cbd722cf4021 upstream.

    On uniprocessor preemptible kernel, target core deadlocks on unload. The
    following events happen:
    * iscsit_del_np is called
    * it calls send_sig(SIGINT, np->np_thread, 1);
    * the scheduler switches to the np_thread
    * the np_thread is woken up, it sees that kthread_should_stop() returns
    false, so it doesn't terminate
    * the np_thread clears signals with flush_signals(current); and goes back
    to sleep in iscsit_accept_np
    * the scheduler switches back to iscsit_del_np
    * iscsit_del_np calls kthread_stop(np->np_thread);
    * the np_thread is waiting in iscsit_accept_np and it doesn't respond to
    kthread_stop

    The deadlock could be resolved if the administrator sends SIGINT signal to
    the np_thread with killall -INT iscsi_np

    The reproducible deadlock was introduced in commit
    db6077fd0b7dd41dc6ff18329cec979379071f87, but the thread-stopping code was
    racy even before.

    This patch fixes the problem. Using kthread_should_stop to stop the
    np_thread is unreliable, so we test np_thread_state instead. If
    np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Mikulas Patocka
     
  • commit 683497566d48f86e04d026de1ee658dd74fc1077 upstream.

    This patch adds a explicit memset to the login response PDU
    exception path in iscsit_tx_login_rsp().

    This addresses a regression bug introduced in commit baa4d64b
    where the initiator would end up not receiving the login
    response and associated status class + detail, before closing
    the login connection.

    Reported-by: Christophe Vu-Brugier
    Tested-by: Christophe Vu-Brugier
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Bellinger
     
  • commit 97c99b47ac58bacb7c09e1f47d5d184434f6b06a upstream.

    This patch changes iscsit_check_dataout_hdr() to dump the incoming
    Data-Out payload when the received ITT is not associated with a
    WRITE, instead of calling iscsit_reject_cmd() for the non WRITE
    ITT descriptor.

    This addresses a bug where an initiator sending an Data-Out for
    an ITT associated with a READ would end up generating a reject
    for the READ, eventually resulting in list corruption.

    Reported-by: Santosh Kulkarni
    Reported-by: Arshad Hussain
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Bellinger
     
  • commit 83ff42fcce070801a3aa1cd6a3269d7426271a8d upstream.

    This patch fixes a left-over se_lun->lun_sep pointer OOPs when one
    of the /sys/kernel/config/target/$FABRIC/$WWPN/$TPGT/lun/$LUN/alua*
    attributes is accessed after the $DEVICE symlink has been removed.

    To address this bug, go ahead and clear se_lun->lun_sep memory in
    core_dev_unexport(), so that the existing checks for show/store
    ALUA attributes in target_core_fabric_configfs.c work as expected.

    Reported-by: Sebastian Herbszt
    Tested-by: Sebastian Herbszt
    Signed-off-by: Nicholas Bellinger
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Bellinger
     
  • commit e6015c1f8a9032c2aecb78d23edf49582563bd47 upstream.

    This change places MDMA1 in disabled node for Exynos5420.
    If MDMA1 region is configured with secure mode, it makes
    the boot failure with the following on smdk5420 board.
    ("Unhandled fault: imprecise external abort (0x1406) at 0x00000000")
    Thus, arndale-octa board don't need to do the same thing anymore.

    Signed-off-by: Seungwon Jeon
    Tested-by: Javi Merino
    Signed-off-by: Kukjin Kim
    Signed-off-by: Tushar Behera
    Signed-off-by: Greg Kroah-Hartman

    Seungwon Jeon
     

01 Jul, 2014

13 commits

  • Greg Kroah-Hartman
     
  • commit 783ee43118dc773bc8b0342c5b230e017d5a04d0 upstream.

    In generic_id the long int timestamp is multiplied by 100000 and needs
    an explicit cast to u64.

    Without that the id in the resulting pstore filename is wrong and
    userspace may have problems parsing it, but more importantly files in
    pstore can never be deleted and may fill the EFI flash (brick device?).
    This happens because when generic pstore code wants to delete a file,
    it passes the id to the EFI backend which reinterpretes it and a wrong
    variable name is attempted to be deleted. There's no error message but
    after remounting pstore, deleted files would reappear.

    Signed-off-by: Andrew Zaborowski
    Acked-by: David Rientjes
    Signed-off-by: Matt Fleming
    Signed-off-by: Greg Kroah-Hartman

    Andrzej Zaborowski
     
  • commit 6b4a144a92ab81a1f45fb9b12aebaaaee0d08120 upstream.

    In cross-build environment, we expect to use the cross-compiler objcopy
    instead of the host objcopy.

    It fixes following build failures:
    objcopy --only-keep-debug lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko /srv/build/linux/debian/dbgtmp/usr/lib/debug/lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko
    objcopy: Unable to recognise the format of the input file `lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko'

    Signed-off-by: Fathi Boudra
    Fixes: 810e843746b7 ('deb-pkg: split debug symbols in their own package')
    Reviewed-by: Ben Hutchings
    Signed-off-by: Michal Marek
    Signed-off-by: Greg Kroah-Hartman

    Fathi Boudra
     
  • commit ebe06187bf2aec10d537ce4595e416035367d703 upstream.

    This fixes use-after-free of epi->fllink.next inside list loop macro.
    This loop actually releases elements in the body. The list is
    rcu-protected but here we cannot hold rcu_read_lock because we need to
    lock mutex inside.

    The obvious solution is to use list_for_each_entry_safe(). RCU-ness
    isn't essential because nobody can change this list under us, it's final
    fput for this file.

    The bug was introduced by ae10b2b4eb01 ("epoll: optimize EPOLL_CTL_DEL
    using rcu")

    Signed-off-by: Konstantin Khlebnikov
    Reported-by: Cyrill Gorcunov
    Cc: Sasha Levin
    Cc: Jason Baron
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Konstantin Khlebnikov
     
  • commit 554086d85e71f30abe46fc014fea31929a7c6a8a upstream.

    The bad syscall nr paths are their own incomprehensible route
    through the entry control flow. Rearrange them to work just like
    syscalls that return -ENOSYS.

    This fixes an OOPS in the audit code when fast-path auditing is
    enabled and sysenter gets a bad syscall nr (CVE-2014-4508).

    This has probably been broken since Linux 2.6.27:
    af0575bba0 i386 syscall audit fast-path

    Cc: Roland McGrath
    Reported-by: Toralf Förster
    Signed-off-by: Andy Lutomirski
    Link: http://lkml.kernel.org/r/e09c499eade6fc321266dd6b54da7beb28d6991c.1403558229.git.luto@amacapital.net
    Signed-off-by: H. Peter Anvin
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     
  • commit 4148c1f67abf823099b2d7db6851e4aea407f5ee upstream.

    There is one other possible overrun in the lz4 code as implemented by
    Linux at this point in time (which differs from the upstream lz4
    codebase, but will get synced at in a future kernel release.) As
    pointed out by Don, we also need to check the overflow in the data
    itself.

    While we are at it, replace the odd error return value with just a
    "simple" -1 value as the return value is never used for anything other
    than a basic "did this work or not" check.

    Reported-by: "Don A. Bailey"
    Reported-by: Willy Tarreau
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • commit c1895442be01c58449e3bf9272f22062a670e08f upstream.

    We are currently allocating space_info objects in an array when we
    allocate space_info. When a user does something like:

    # btrfs balance start -mconvert=raid1 -dconvert=raid1 /mnt
    # btrfs balance start -mconvert=single -dconvert=single /mnt -f
    # btrfs balance start -mconvert=raid1 -dconvert=raid1 /

    We can end up with memory corruption since the kobject hasn't
    been reinitialized properly and the name pointer was left set.

    The rationale behind allocating them statically was to avoid
    creating a separate kobject container that just contained the
    raid type. It used the index in the array to determine the index.

    Ultimately, though, this wastes more memory than it saves in all
    but the most complex scenarios and introduces kobject lifetime
    questions.

    This patch allocates the kobjects dynamically instead. Note that
    we also remove the kobject_get/put of the parent kobject since
    kobject_add and kobject_del do that internally.

    Signed-off-by: Jeff Mahoney
    Reported-by: David Sterba
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Jeff Mahoney
     
  • commit ed55b6ac077fe7f9c6490ff55172c4b563562d7c upstream.

    When encountering memory pressure, testers have run into the following
    lockdep warning. It was caused by __link_block_group calling kobject_add
    with the groups_sem held. kobject_add calls kvasprintf with GFP_KERNEL,
    which gets us into reclaim context. The kobject doesn't actually need
    to be added under the lock -- it just needs to ensure that it's only
    added for the first block group to be linked.

    =========================================================
    [ INFO: possible irq lock inversion dependency detected ]
    3.14.0-rc8-default #1 Not tainted
    ---------------------------------------------------------
    kswapd0/169 just changed the state of lock:
    (&delayed_node->mutex){+.+.-.}, at: [] __btrfs_release_delayed_node+0x3a/0x200 [btrfs]
    but this lock took another, RECLAIM_FS-unsafe lock in the past:
    (&found->groups_sem){+++++.}

    and interrupts could create inverse lock ordering between them.

    other info that might help us debug this:
    Possible interrupt unsafe locking scenario:
    CPU0 CPU1
    ---- ----
    lock(&found->groups_sem);
    local_irq_disable();
    lock(&delayed_node->mutex);
    lock(&found->groups_sem);

    lock(&delayed_node->mutex);

    *** DEADLOCK ***
    2 locks held by kswapd0/169:
    #0: (shrinker_rwsem){++++..}, at: [] shrink_slab+0x3a/0x160
    #1: (&type->s_umount_key#27){++++..}, at: [] grab_super_passive+0x3f/0x90

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Jeff Mahoney
     
  • commit 3e2426bd0eb980648449e7a2f5a23e3cd3c7725c upstream.

    If this condition in end_extent_writepage() is false:

    if (tree->ops && tree->ops->writepage_end_io_hook)

    we will then test an uninitialized "ret" at:

    ret = ret < 0 ? ret : -EIO;

    The test for ret is for the case where ->writepage_end_io_hook
    failed, and we'd choose that ret as the error; but if
    there is no ->writepage_end_io_hook, nothing sets ret.

    Initializing ret to 0 should be sufficient; if
    writepage_end_io_hook wasn't set, (!uptodate) means
    non-zero err was passed in, so we choose -EIO in that case.

    Signed-of-by: Eric Sandeen

    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Eric Sandeen
     
  • commit 6eda71d0c030af0fc2f68aaa676e6d445600855b upstream.

    The skinny extents are intepreted incorrectly in scrub_print_warning(),
    and end up hitting the BUG() in btrfs_extent_inline_ref_size.

    Reported-by: Konstantinos Skarlatos
    Signed-off-by: Liu Bo
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Liu Bo
     
  • commit cd857dd6bc2ae9ecea14e75a34e8a8fdc158e307 upstream.

    We want to make sure the point is still within the extent item, not to verify
    the memory it's pointing to.

    Signed-off-by: Liu Bo
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Liu Bo
     
  • commit 8a56457f5f8fa7c2698ffae8545214c5b96a2cb5 upstream.

    The backref code was looking at nodes as well as leaves when we tried to
    populate extent item entries. This is not good, and although we go away with it
    for the most part because we'd skip where disk_bytenr != random_memory,
    sometimes random_memory would match and suddenly boom. This fixes that problem.
    Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Josef Bacik
     
  • commit 8321cf2596d283821acc466377c2b85bcd3422b7 upstream.

    There is otherwise a risk of a possible null pointer dereference.

    Was largely found by using a static code analysis program called cppcheck.

    Signed-off-by: Rickard Strandqvist
    Signed-off-by: Chris Mason
    Signed-off-by: Greg Kroah-Hartman

    Rickard Strandqvist