10 Jul, 2014

40 commits

  • Greg Kroah-Hartman
     
  • commit d05f0cdcbe6388723f1900c549b4850360545201 upstream.

    In v2.6.34 commit 9d8cebd4bcd7 ("mm: fix mbind vma merge problem")
    introduced vma merging to mbind(), but it should have also changed the
    convention of passing start vma from queue_pages_range() (formerly
    check_range()) to new_vma_page(): vma merging may have already freed
    that structure, resulting in BUG at mm/mempolicy.c:1738 and probably
    worse crashes.

    Fixes: 9d8cebd4bcd7 ("mm: fix mbind vma merge problem")
    Reported-by: Naoya Horiguchi
    Tested-by: Naoya Horiguchi
    Signed-off-by: Hugh Dickins
    Acked-by: Christoph Lameter
    Cc: KOSAKI Motohiro
    Cc: Minchan Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Hugh Dickins
     
  • commit fd1232b214af43a973443aec6a2808f16ee5bf70 upstream.

    This patch fixes I/O errors with the sym53c8xx_2 driver when the disk
    returns QUEUE FULL status.

    When the controller encounters an error (including QUEUE FULL or BUSY
    status), it aborts all not yet submitted requests in the function
    sym_dequeue_from_squeue.

    This function aborts them with DID_SOFT_ERROR.

    If the disk has full tag queue, the request that caused the overflow is
    aborted with QUEUE FULL status (and the scsi midlayer properly retries
    it until it is accepted by the disk), but the sym53c8xx_2 driver aborts
    the following requests with DID_SOFT_ERROR --- for them, the midlayer
    does just a few retries and then signals the error up to sd.

    The result is that disk returning QUEUE FULL causes request failures.

    The error was reproduced on 53c895 with COMPAQ BD03685A24 disk
    (rebranded ST336607LC) with command queue 48 or 64 tags. The disk has
    64 tags, but under some access patterns it return QUEUE FULL when there
    are less than 64 pending tags. The SCSI specification allows returning
    QUEUE FULL anytime and it is up to the host to retry.

    Signed-off-by: Mikulas Patocka
    Cc: Matthew Wilcox
    Cc: James Bottomley
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Mikulas Patocka
     
  • commit 03787301420376ae41fbaf4267f4a6253d152ac5 upstream.

    Commit b1cb0982bdd6 ("change the management method of free objects of
    the slab") introduced a bug on slab leak detector
    ('/proc/slab_allocators'). This detector works like as following
    decription.

    1. traverse all objects on all the slabs.
    2. determine whether it is active or not.
    3. if active, print who allocate this object.

    but that commit changed the way how to manage free objects, so the logic
    determining whether it is active or not is also changed. In before, we
    regard object in cpu caches as inactive one, but, with this commit, we
    mistakenly regard object in cpu caches as active one.

    This intoduces kernel oops if DEBUG_PAGEALLOC is enabled. If
    DEBUG_PAGEALLOC is enabled, kernel_map_pages() is used to detect who
    corrupt free memory in the slab. It unmaps page table mapping if object
    is free and map it if object is active. When slab leak detector check
    object in cpu caches, it mistakenly think this object active so try to
    access object memory to retrieve caller of allocation. At this point,
    page table mapping to this object doesn't exist, so oops occurs.

    Following is oops message reported from Dave.

    It blew up when something tried to read /proc/slab_allocators
    (Just cat it, and you should see the oops below)

    Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
    Modules linked in:
    [snip...]
    CPU: 1 PID: 9386 Comm: trinity-c33 Not tainted 3.14.0-rc5+ #131
    task: ffff8801aa46e890 ti: ffff880076924000 task.ti: ffff880076924000
    RIP: 0010:[] [] handle_slab+0x8a/0x180
    RSP: 0018:ffff880076925de0 EFLAGS: 00010002
    RAX: 0000000000001000 RBX: 0000000000000000 RCX: 000000005ce85ce7
    RDX: ffffea00079be100 RSI: 0000000000001000 RDI: ffff880107458000
    RBP: ffff880076925e18 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000000 R11: 000000000000000f R12: ffff8801e6f84000
    R13: ffffea00079be100 R14: ffff880107458000 R15: ffff88022bb8d2c0
    FS: 00007fb769e45740(0000) GS:ffff88024d040000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffff8801e6f84ff8 CR3: 00000000a22db000 CR4: 00000000001407e0
    DR0: 0000000002695000 DR1: 0000000002695000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000070602
    Call Trace:
    leaks_show+0xce/0x240
    seq_read+0x28e/0x490
    proc_reg_read+0x3d/0x80
    vfs_read+0x9b/0x160
    SyS_read+0x58/0xb0
    tracesys+0xd4/0xd9
    Code: f5 00 00 00 0f 1f 44 00 00 48 63 c8 44 3b 0c 8a 0f 84 e3 00 00 00 83 c0 01 44 39 c0 72 eb 41 f6 47 1a 01 0f 84 e9 00 00 00 89 f0 8b 4c 04 f8 4d 85 c9 0f 84 88 00 00 00 49 8b 7e 08 4d 8d 46
    RIP handle_slab+0x8a/0x180

    To fix the problem, I introduce an object status buffer on each slab.
    With this, we can track object status precisely, so slab leak detector
    would not access active object and no kernel oops would occur. Memory
    overhead caused by this fix is only imposed to CONFIG_DEBUG_SLAB_LEAK
    which is mainly used for debugging, so memory overhead isn't big
    problem.

    Signed-off-by: Joonsoo Kim
    Reported-by: Dave Jones
    Reported-by: Tetsuo Handa
    Reviewed-by: Vladimir Davydov
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Joonsoo Kim
     
  • commit 107437febd495a50e2cd09c81bbaa84d30e57b07 upstream.

    Changing PTEs and PMDs to pte_numa & pmd_numa is done with the
    mmap_sem held for reading, which means a pmd can be instantiated
    and turned into a numa one while __handle_mm_fault() is examining
    the value of old_pmd.

    If that happens, __handle_mm_fault() should just return and let
    the page fault retry, instead of throwing an oops. This is
    handled by the test for pmd_trans_huge(*pmd) below.

    Signed-off-by: Rik van Riel
    Reviewed-by: Naoya Horiguchi
    Reported-by: Sunil Pandey
    Signed-off-by: Peter Zijlstra
    Cc: Andrew Morton
    Cc: Johannes Weiner
    Cc: Kirill A. Shutemov
    Cc: Linus Torvalds
    Cc: Mel Gorman
    Cc: linux-mm@kvack.org
    Cc: lwoodman@redhat.com
    Cc: dave.hansen@intel.com
    Link: http://lkml.kernel.org/r/20140429153615.2d72098e@annuminas.surriel.com
    Signed-off-by: Ingo Molnar
    Patrick McLean
    Signed-off-by: Greg Kroah-Hartman

    Rik van Riel
     
  • commit fbc6c4a13bbfb420eedfdb26a0a859f9c07e8a7b upstream.

    Function unifb_mmap calls functions which are defined in linux/mm.h
    and asm/pgtable.h

    The related error (for unicore32 with unicore32_defconfig):
    CC drivers/video/fbdev/fb-puv3.o
    drivers/video/fbdev/fb-puv3.c: In function 'unifb_mmap':
    drivers/video/fbdev/fb-puv3.c:646: error: implicit declaration of
    function 'vm_iomap_memory'
    drivers/video/fbdev/fb-puv3.c:646: error: implicit declaration of
    function 'pgprot_noncached'

    Signed-off-by: Zhichuang Sun
    Cc: Jean-Christophe Plagniol-Villard
    Cc: Tomi Valkeinen
    Cc: Jingoo Han
    Cc: Daniel Vetter
    Cc: Joe Perches
    Cc: Laurent Pinchart
    Cc: linux-fbdev@vger.kernel.org
    Acked-by: Xuetao Guan
    Signed-off-by: Tomi Valkeinen
    Cc: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Zhichuang SUN
     
  • commit 1ff38c56cbd095c4c0dfa581a859ba3557830f78 upstream.

    Need include "asm/pgtable.h" to include "asm-generic/pgtable-nopmd.h",
    so can let 'pmd_t' defined. The related error with allmodconfig:

    CC arch/unicore32/mm/alignment.o
    In file included from arch/unicore32/mm/alignment.c:24:
    arch/unicore32/include/asm/tlbflush.h:135: error: expected .). before .*. token
    arch/unicore32/include/asm/tlbflush.h:154: error: expected .). before .*. token
    In file included from arch/unicore32/mm/alignment.c:27:
    arch/unicore32/mm/mm.h:15: error: expected .=., .,., .;., .sm. or ._attribute__. before .*. token
    arch/unicore32/mm/mm.h:20: error: expected .=., .,., .;., .sm. or ._attribute__. before .*. token
    arch/unicore32/mm/mm.h:25: error: expected .=., .,., .;., .sm. or ._attribute__. before .*. token
    make[1]: *** [arch/unicore32/mm/alignment.o] Error 1
    make: *** [arch/unicore32/mm] Error 2

    Signed-off-by: Chen Gang
    Acked-by: Xuetao Guan
    Signed-off-by: Xuetao Guan
    Cc: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Chen Gang
     
  • commit b7a7723513dc89f83d6df13206df55d4dc26e825 upstream.

    This (widely used) construction:

    if(printk_ratelimit())
    dev_dbg()

    Causes the ratelimiting to spam the kernel log with the "callbacks suppressed"
    message below, even while the dev_dbg it is supposed to rate limit wouldn't
    print anything because DEBUG is not defined for this device.

    [ 533.803964] retire_playback_urb: 852 callbacks suppressed
    [ 538.807930] retire_playback_urb: 852 callbacks suppressed
    [ 543.811897] retire_playback_urb: 852 callbacks suppressed
    [ 548.815745] retire_playback_urb: 852 callbacks suppressed
    [ 553.819826] retire_playback_urb: 852 callbacks suppressed

    So use dev_dbg_ratelimited() instead of this construction.

    Signed-off-by: Sander Eikelenboom
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Sander Eikelenboom
     
  • commit a5065eb6da55b226661456e6a7435f605df98111 upstream.

    BugLink: http://bugs.launchpad.net/bugs/1305133

    Malfunctioning or slow devices can cause a flood of dmesg SPAM.

    I've ignored checkpatch.pl complaints about the use of printk_ratelimit() in favour
    of prior art in sound/usb/pcm.c.

    WARNING: Prefer printk_ratelimited or pr__ratelimited to printk_ratelimit
    + if (printk_ratelimit() &&

    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Cc: Eldad Zack
    Cc: Daniel Mack
    Cc: Clemens Ladisch
    Signed-off-by: Tim Gardner
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Tim Gardner
     
  • commit aa589a13b5d00d3c643ee4114d8cbc3addb4e99f upstream.

    The new- prefix on ses and auid are un-necessary and break ausearch.

    Signed-off-by: Richard Guy Briggs
    Reported-by: Steve Grubb
    Signed-off-by: Greg Kroah-Hartman

    Richard Guy Briggs
     
  • commit e02ba72aabfade4c9cd6e3263e9b57bf890ad25c upstream.

    deletes aio context and all resources related to. It makes sense that
    no IO operations connected to the context should be running after the context
    is destroyed. As we removed io_context we have no chance to
    get requests status or call io_getevents().

    man page for io_destroy says that this function may block until
    all context's requests are completed. Before kernel 3.11 io_destroy()
    blocked indeed, but since aio refactoring in 3.11 it is not true anymore.

    Here is a pseudo-code that shows a testcase for a race condition discovered
    in 3.11:

    initialize io_context
    io_submit(read to buffer)
    io_destroy()

    // context is destroyed so we can free the resources
    free(buffers);

    // if the buffer is allocated by some other user he'll be surprised
    // to learn that the buffer still filled by an outstanding operation
    // from the destroyed io_context

    The fix is straight-forward - add a completion struct and wait on it
    in io_destroy, complete() should be called when number of in-fligh requests
    reaches zero.

    If two or more io_destroy() called for the same context simultaneously then
    only the first one waits for IO completion, other calls behaviour is undefined.

    Tested: ran http://pastebin.com/LrPsQ4RL testcase for several hours and
    do not see the race condition anymore.

    Signed-off-by: Anatol Pomozov
    Signed-off-by: Benjamin LaHaise
    Cc: Jan Kara
    Signed-off-by: Greg Kroah-Hartman

    Anatol Pomozov
     
  • commit b8c000d9bf23e7c1155ef421f595d1cbc25262da upstream.

    Atm, we refcount both power domains and power wells and
    intel_display_power_enabled_sw() returns the power domain refcount. What
    the callers are really interested in though is the sw state of the
    underlying power wells. Due to this we will report incorrectly that a
    given power domain is off if its power wells were enabled via another
    power domain, for example POWER_DOMAIN_INIT which enables all power
    wells.

    As a fix return instead the state based on the refcount of all power
    wells included in the passed in power domain.

    References: https://bugs.freedesktop.org/show_bug.cgi?id=79505
    References: https://bugs.freedesktop.org/show_bug.cgi?id=79038
    Reported-by: Chris Wilson
    Signed-off-by: Imre Deak
    Reviewed-by: Damien Lespiau
    Signed-off-by: Daniel Vetter
    Acked-by: Jani Nikula
    Signed-off-by: Greg Kroah-Hartman

    Imre Deak
     
  • commit 5027251eced6e34315a52bd841279df957f627bb upstream.

    a27fbf2f067b0cd ("mmc: add ignorance case for CMD13 CRC error") produced
    a cmd.flags unhandled in realtek pci host driver. This will make MMC
    card fail to initialize, this patch is used to handle the new cmd.flags
    condition and MMC card can be used.

    Signed-off-by: Micky Ching
    Signed-off-by: Ulf Hansson
    Signed-off-by: Chris Ball
    Signed-off-by: Greg Kroah-Hartman

    Micky Ching
     
  • commit ffa216bb5eecfce0f01b0b2a95d5c320dde90005 upstream.

    brcmfmac has been broken on my cubietruck with a BCM43362:

    brcmfmac: brcmf_chip_recognition: found AXI chip: BCM43362, rev=1
    brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0:
    Apr 22 2013 14:50:00 version 5.90.195.89.6 FWID 01-b30a427d

    since commit 53036261033: "brcmfmac: update core reset and disable routines".

    The problem is that since this commit brcmf_chip_ai_resetcore no longer sets
    BCMA_IOCTL itself before bringing the core out of reset, instead relying on
    brcmf_chip_ai_coredisable to do so. But brcmf_chip_ai_coredisable is a nop
    of the chip is already in reset. This patch modifies brcmf_chip_ai_coredisable
    to always set BCMA_IOCTL even if the core is already in reset.

    This fixes brcmfmac hanging in firmware loading on my board.

    Cc: stable@vger.kernel.org # v3.14
    Signed-off-by: Hans de Goede
    Acked-by: Arend van Spriel
    Signed-off-by: John W. Linville
    [arend@broadcom.com: rebase patch on linux-3.14.y branch]
    Signed-off-by: Arend van Spriel
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • commit 945b2b2d259d1a4364a2799e80e8ff32f8c6ee6f upstream.

    Quoting Samu Kallio:

    Basically what's happening is, during netns cleanup,
    nf_nat_net_exit gets called before ipv4_net_exit. As I understand
    it, nf_nat_net_exit is supposed to kill any conntrack entries which
    have NAT context (through nf_ct_iterate_cleanup), but for some
    reason this doesn't happen (perhaps something else is still holding
    refs to those entries?).

    When ipv4_net_exit is called, conntrack entries (including those
    with NAT context) are cleaned up, but the
    nat_bysource hashtable is long gone - freed in nf_nat_net_exit. The
    bug happens when attempting to free a conntrack entry whose NAT hash
    'prev' field points to a slot in the freed hash table (head for that
    bin).

    We ignore conntracks with null nat bindings. But this is wrong,
    as these are in bysource hash table as well.

    Restore nat-cleaning for the netns-is-being-removed case.

    bug:
    https://bugzilla.kernel.org/show_bug.cgi?id=65191

    Fixes: c2d421e1718 ('netfilter: nf_nat: fix race when unloading protocol modules')
    Reported-by: Samu Kallio
    Debugged-by: Samu Kallio
    Signed-off-by: Florian Westphal
    Tested-by: Samu Kallio
    Signed-off-by: Pablo Neira Ayuso
    Signed-off-by: Greg Kroah-Hartman

    Florian Westphal
     
  • commit 66528f90669691c85c73bea4f0c9f4a5857c4cab upstream.

    If INPCK is not set, input parity detection should be disabled. This means
    parity errors should not be received from the tty driver, and the data
    received should be treated normally.

    SUS v3, 11.2.2, General Terminal Interface - Input Modes, states:
    "If INPCK is set, input parity checking shall be enabled. If INPCK is
    not set, input parity checking shall be disabled, allowing output parity
    generation without input parity errors. Note that whether input parity
    checking is enabled or disabled is independent of whether parity detection
    is enabled or disabled (see Control Modes). If parity detection is enabled
    but input parity checking is disabled, the hardware to which the terminal
    is connected shall recognize the parity bit, but the terminal special file
    shall not check whether or not this bit is correctly set."

    Ignore parity errors reported by the tty driver when INPCK is not set, and
    handle the received data normally.

    Fixes: Bugzilla #71681, 'Improvement of n_tty_receive_parity_error from n_tty.c'
    Reported-by: Ivan
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • commit ef8b9ddcb45fa3b1e11acd72be2398001e807d14 upstream.

    If IGNBRK is set without either BRKINT or PARMRK set, some uart
    drivers send a 0x00 byte for BREAK without the TTYBREAK flag to the
    line discipline, when it should send either nothing or the TTYBREAK flag
    set. This happens because the read_status_mask masks out the BI
    condition, which uart_insert_char() then interprets as a normal 0x00 byte.

    SUS v3 is clear regarding the meaning of IGNBRK; Section 11.2.2, General
    Terminal Interface - Input Modes, states:
    "If IGNBRK is set, a break condition detected on input shall be ignored;
    that is, not put on the input queue and therefore not read by any
    process."

    Fix read_status_mask to include the BI bit if IGNBRK is set; the
    lsr status retains the BI bit if a BREAK is recv'd, which is
    subsequently ignored in uart_insert_char() when masked with the
    ignore_status_mask.

    Affected drivers:
    8250 - all
    serial_txx9
    mfd
    amba-pl010
    amba-pl011
    atmel_serial
    bfin_uart
    dz
    ip22zilog
    max310x
    mxs-auart
    netx-serial
    pnx8xxx_uart
    pxa
    sb1250-duart
    sccnxp
    serial_ks8695
    sirfsoc_uart
    st-asc
    vr41xx_siu
    zs
    sunzilog
    fsl_lpuart
    sunsab
    ucc_uart
    bcm63xx_uart
    sunsu
    efm32-uart
    pmac_zilog
    mpsc
    msm_serial
    m32r_sio

    Unaffected drivers:
    omap-serial
    rp2
    sa1100
    imx
    icom

    Annotated for fixes:
    altera_uart
    mcf

    Drivers without break detection:
    21285
    xilinx-uartps
    altera_jtaguart
    apbuart
    arc-uart
    clps711x
    max3100
    uartlite
    msm_serial_hs
    nwpserial
    lantiq
    vt8500_serial

    Unknown:
    samsung
    mpc52xx_uart
    bfin_sport_uart
    cpm_uart/core

    Fixes: Bugzilla #71651, '8250_core.c incorrectly handles IGNBRK flag'
    Reported-by: Ivan
    Signed-off-by: Peter Hurley
    Signed-off-by: Greg Kroah-Hartman

    Peter Hurley
     
  • commit 437ae6a1b8f2eedebfbf0f6572e19ca5c58a3f71 upstream.

    We forgot to add the status bit for the PLLs and we were using
    the wrong register and masks for configuration, leading to
    unexpected PLL configurations. Fix this.

    Fixes: d8b212014e69 (clk: qcom: Add support for MSM8974's multimedia clock controller (MMCC))
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mike Turquette
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • commit aa014149ba002155a084ec1e9328e95b70167cbb upstream.

    If the bit is set the clock is off so we should be checking for
    a clear bit, not a set bit. Invert the logic.

    Fixes: bcd61c0f535a (clk: qcom: Add support for root clock generators (RCGs))
    Signed-off-by: Stephen Boyd
    Signed-off-by: Mike Turquette
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     
  • commit bc82878baa10c2a6a4a6affaf52c152935112142 upstream.

    Commit eb17711bc1d6 ("net/mlx4_core: Introduce nic_info new flag in
    QUERY_FUNC_CAP") did:

    if (func_cap->flags1 & QUERY_FUNC_CAP_FLAGS1_OFFSET) {

    which should be:

    if (func_cap->flags1 & QUERY_FUNC_CAP_FLAGS1_FORCE_VLAN) {

    Fix that.

    Fixes: eb17711bc1d6 ("net/mlx4_core: Introduce nic_info new flag in QUERY_FUNC_CAP")
    Signed-off-by: Jack Morgenstein
    Signed-off-by: Or Gerlitz
    Signed-off-by: Roland Dreier
    Signed-off-by: Greg Kroah-Hartman

    Jack Morgenstein
     
  • commit dc78327c0ea7da5186d8cbc1647bd6088c5c9fa5 upstream.

    With a kernel configured with ARM64_64K_PAGES && !TRANSPARENT_HUGEPAGE,
    the following is triggered at early boot:

    SMP: Total of 8 processors activated.
    devtmpfs: initialized
    Unable to handle kernel NULL pointer dereference at virtual address 00000008
    pgd = fffffe0000050000
    [00000008] *pgd=00000043fba00003, *pmd=00000043fba00003, *pte=00e0000078010407
    Internal error: Oops: 96000006 [#1] SMP
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.15.0-rc864k+ #44
    task: fffffe03bc040000 ti: fffffe03bc080000 task.ti: fffffe03bc080000
    PC is at __list_add+0x10/0xd4
    LR is at free_one_page+0x270/0x638
    ...
    Call trace:
    __list_add+0x10/0xd4
    free_one_page+0x26c/0x638
    __free_pages_ok.part.52+0x84/0xbc
    __free_pages+0x74/0xbc
    init_cma_reserved_pageblock+0xe8/0x104
    cma_init_reserved_areas+0x190/0x1e4
    do_one_initcall+0xc4/0x154
    kernel_init_freeable+0x204/0x2a8
    kernel_init+0xc/0xd4

    This happens because init_cma_reserved_pageblock() calls
    __free_one_page() with pageblock_order as page order but it is bigger
    than MAX_ORDER. This in turn causes accesses past zone->free_list[].

    Fix the problem by changing init_cma_reserved_pageblock() such that it
    splits pageblock into individual MAX_ORDER pages if pageblock is bigger
    than a MAX_ORDER page.

    In cases where !CONFIG_HUGETLB_PAGE_SIZE_VARIABLE, which is all
    architectures expect for ia64, powerpc and tile at the moment, the
    “pageblock_order > MAX_ORDER” condition will be optimised out since both
    sides of the operator are constants. In cases where pageblock size is
    variable, the performance degradation should not be significant anyway
    since init_cma_reserved_pageblock() is called only at boot time at most
    MAX_CMA_AREAS times which by default is eight.

    Signed-off-by: Michal Nazarewicz
    Reported-by: Mark Salter
    Tested-by: Mark Salter
    Tested-by: Christopher Covington
    Cc: Mel Gorman
    Cc: David Rientjes
    Cc: Marek Szyprowski
    Cc: Catalin Marinas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Michal Nazarewicz
     
  • commit 4f4366033945419b0c52118c29d3057d7c558765 upstream.

    The ras3 block on spear320 claims to have 3 interrupts. In fact it has
    one and 6 reserved interrupts. Account the 6 reserved to this block so
    it has 7 interrupts total. That matches the datasheet and the device
    tree entries.

    Broken since commit 80515a5a(ARM: SPEAr3xx: shirq: simplify and move
    the shared irq multiplexor to DT). Testing is overrated....

    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20140619212712.872379208@linutronix.de
    Fixes: 80515a5a2e3c ('ARM: SPEAr3xx: shirq: simplify and move the shared irq multiplexor to DT')
    Acked-by: Viresh Kumar
    Signed-off-by: Jason Cooper
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • commit 133d4527eab8d199a62eee6bd433f0776842df2e upstream.

    When we write to a degraded array which has a bitmap, we
    make sure the relevant bit in the bitmap remains set when
    the write completes (so a 're-add' can quickly rebuilt a
    temporarily-missing device).

    If, immediately after such a write starts, we incorporate a spare,
    commence recovery, and skip over the region where the write is
    happening (because the 'needs recovery' flag isn't set yet),
    then that write will not get to the new device.

    Once the recovery finishes the new device will be trusted, but will
    have incorrect data, leading to possible corruption.

    We cannot set the 'needs recovery' flag when we start the write as we
    do not know easily if the write will be "degraded" or not. That
    depends on details of the particular raid level and particular write
    request.

    This patch fixes a corruption issue of long standing and so it
    suitable for any -stable kernel. It applied correctly to 3.0 at
    least and will minor editing to earlier kernels.

    Reported-by: Bill
    Tested-by: Bill
    Link: http://lkml.kernel.org/r/53A518BB.60709@sbcglobal.net
    Signed-off-by: NeilBrown
    Signed-off-by: Greg Kroah-Hartman

    NeilBrown
     
  • commit 099ed151675cd1d2dbeae1dac697975f6a68716d upstream.

    Disabling reading and writing to the trace file should not be able to
    disable all function tracing callbacks. There's other users today
    (like kprobes and perf). Reading a trace file should not stop those
    from happening.

    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (Red Hat)
     
  • commit f35f71244da6e51db4e1f2c7e318581f498ececf upstream.

    It appears that no one ever run ffs-test on a big-endian machine,
    since it used cpu-endianess for fs_count and hs_count fields which
    should be in little-endian format. Fix by wrapping the numbers in
    cpu_to_le32.

    Signed-off-by: Michal Nazarewicz
    Signed-off-by: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Michal Nazarewicz
     
  • commit 76f47128f9b33af1e96819746550d789054c9664 upstream.

    An NFS operation that creates a new symlink includes the symlink data,
    which is xdr-encoded as a length followed by the data plus 0 to 3 bytes
    of zero-padding as required to reach a 4-byte boundary.

    The vfs, on the other hand, wants null-terminated data.

    The simple way to handle this would be by copying the data into a newly
    allocated buffer with space for the final null.

    The current nfsd_symlink code tries to be more clever by skipping that
    step in the (likely) case where the byte following the string is already
    0.

    But that assumes that the byte following the string is ours to look at.
    In fact, it might be the first byte of a page that we can't read, or of
    some object that another task might modify.

    Worse, the NFSv4 code tries to fix the problem by actually writing to
    that byte.

    In the NFSv2/v3 cases this actually appears to be safe:

    - nfs3svc_decode_symlinkargs explicitly null-terminates the data
    (after first checking its length and copying it to a new
    page).
    - NFSv2 limits symlinks to 1k. The buffer holding the rpc
    request is always at least a page, and the link data (and
    previous fields) have maximum lengths that prevent the request
    from reaching the end of a page.

    In the NFSv4 case the CREATE op is potentially just one part of a long
    compound so can end up on the end of a page if you're unlucky.

    The minimal fix here is to copy and null-terminate in the NFSv4 case.
    The nfsd_symlink() interface here seems too fragile, though. It should
    really either do the copy itself every time or just require a
    null-terminated string.

    Reported-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Greg Kroah-Hartman

    J. Bruce Fields
     
  • commit b70e19c222a64018d308ebc80333575aff9f4e51 upstream.

    We should be returning a negative error code instead of success here.

    This would have been detected by GCC, except that the "ret" variable was
    initialized with a bogus value to disable GCC's uninitialized variable
    warnings. I've cleaned that up, as well.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • commit a2c12493ed7e63a18cef33a71686d12ffcd6600e upstream.

    Currently in the inkern.c code for IIO framework, the function
    of_iio_channel_get_by_name() will return a non-NULL pointer when
    it cannot find a channel using of_iio_channel_get() and when it
    tries to search for 'io-channel-ranges' property and fails. This
    is incorrect behaviour as the function which calls this expects
    a NULL pointer for failure. This patch rectifies the issue.

    Signed-off-by: Adam Thomson
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Adam Thomson
     
  • commit e1fa108d24697b78348fd4e5a531029a50d0d36d upstream.

    When kvm_write_guest writes the tsc_ref structure to the guest, or it will lead
    the low HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT bits of the TSC page address
    must be cleared, or the guest can see a non-zero sequence number.

    Otherwise Windows guests would not be able to get a correct clocksource
    (QueryPerformanceCounter will always return 0) which causes serious chaos.

    Signed-off-by: Xiaoming Gao
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Xiaoming Gao
     
  • commit 7cb060a91c0efc5ff94f83c6df3ed705e143cdb9 upstream.

    KVM does not really do much with the PAT, so this went unnoticed for a
    long time. It is exposed however if you try to do rdmsr on the PAT
    register.

    Reported-by: Valentine Sinitsyn
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Paolo Bonzini
     
  • commit 682367c494869008eb89ef733f196e99415ae862 upstream.

    Recent Intel CPUs have 10 variable range MTRRs. Since operating systems
    sometime make assumptions on CPUs while they ignore capability MSRs, it is
    better for KVM to be consistent with recent CPUs. Reporting more MTRRs than
    actually supported has no functional implications.

    Signed-off-by: Nadav Amit
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Nadav Amit
     
  • commit a93cd4cf86466caa49cfe64607bea7f0bde3f916 upstream.

    Hole punching code for files with indirect blocks wrongly computed
    number of blocks which need to be cleared when traversing the indirect
    block tree. That could result in punching more blocks than actually
    requested and thus effectively cause a data loss. For example:

    fallocate -n -p 10240000 4096

    will punch the range 10240000 - 12632064 instead of the range 1024000 -
    10244096. Fix the calculation.

    Fixes: 8bad6fc813a3a5300f51369c39d315679fd88c72
    Signed-off-by: Jan Kara
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Jan Kara
     
  • commit c5c7b8ddfbf8cb3b2291e515a34ab1b8982f5a2d upstream.

    Error recovery in ext4_alloc_branch() calls ext4_forget() even for
    buffer corresponding to indirect block it did not allocate. This leads
    to brelse() being called twice for that buffer (once from ext4_forget()
    and once from cleanup in ext4_ind_map_blocks()) leading to buffer use
    count misaccounting. Eventually (but often much later because there
    are other users of the buffer) we will see messages like:
    VFS: brelse: Trying to free free buffer

    Another manifestation of this problem is an error:
    JBD2 unexpected failure: jbd2_journal_revoke: !buffer_revoked(bh);
    inconsistent data on disk

    The fix is easy - don't forget buffer we did not allocate. Also add an
    explanatory comment because the indexing at ext4_alloc_branch() is
    somewhat subtle.

    Signed-off-by: Jan Kara
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Jan Kara
     
  • commit a5049a8ae34950249a7ae94c385d7c5c98914412 upstream.

    Hello,

    So, this patch should do. Joe, Vivek, can one of you guys please
    verify that the oops goes away with this patch?

    Jens, the original thread can be read at

    http://thread.gmane.org/gmane.linux.kernel/1720729

    The fix converts blkg->refcnt from int to atomic_t. It does some
    overhead but it should be minute compared to everything else which is
    going on and the involved cacheline bouncing, so I think it's highly
    unlikely to cause any noticeable difference. Also, the refcnt in
    question should be converted to a perpcu_ref for blk-mq anyway, so the
    atomic_t is likely to go away pretty soon anyway.

    Thanks.

    ------- 8< -------
    __blkg_release_rcu() may be invoked after the associated request_queue
    is released with a RCU grace period inbetween. As such, the function
    and callbacks invoked from it must not dereference the associated
    request_queue. This is clearly indicated in the comment above the
    function.

    Unfortunately, while trying to fix a different issue, 2a4fd070ee85
    ("blkcg: move bulk of blkcg_gq release operations to the RCU
    callback") ignored this and added [un]locking of @blkg->q->queue_lock
    to __blkg_release_rcu(). This of course can cause oops as the
    request_queue may be long gone by the time this code gets executed.

    general protection fault: 0000 [#1] SMP
    CPU: 21 PID: 30 Comm: rcuos/21 Not tainted 3.15.0 #1
    Hardware name: Stratus ftServer 6400/G7LAZ, BIOS BIOS Version 6.3:57 12/25/2013
    task: ffff880854021de0 ti: ffff88085403c000 task.ti: ffff88085403c000
    RIP: 0010:[] [] _raw_spin_lock_irq+0x15/0x60
    RSP: 0018:ffff88085403fdf0 EFLAGS: 00010086
    RAX: 0000000000020000 RBX: 0000000000000010 RCX: 0000000000000000
    RDX: 000060ef80008248 RSI: 0000000000000286 RDI: 6b6b6b6b6b6b6b6b
    RBP: ffff88085403fdf0 R08: 0000000000000286 R09: 0000000000009f39
    R10: 0000000000020001 R11: 0000000000020001 R12: ffff88103c17a130
    R13: ffff88103c17a080 R14: 0000000000000000 R15: 0000000000000000
    FS: 0000000000000000(0000) GS:ffff88107fca0000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000006e5ab8 CR3: 000000000193d000 CR4: 00000000000407e0
    Stack:
    ffff88085403fe18 ffffffff812cbfc2 ffff88103c17a130 0000000000000000
    ffff88103c17a130 ffff88085403fec0 ffffffff810d1d28 ffff880854021de0
    ffff880854021de0 ffff88107fcaec58 ffff88085403fe80 ffff88107fcaec30
    Call Trace:
    [] __blkg_release_rcu+0x72/0x150
    [] rcu_nocb_kthread+0x1e8/0x300
    [] kthread+0xe1/0x100
    [] ret_from_fork+0x7c/0xb0
    Code: ff 47 04 48 8b 7d 08 be 00 02 00 00 e8 55 48 a4 ff 5d c3 0f 1f 00 66 66 66 66 90 55 48 89 e5
    +fa 66 66 90 66 66 90 b8 00 00 02 00 0f c1 07 89 c2 c1 ea 10 66 39 c2 75 02 5d c3 83 e2 fe 0f
    +b7
    RIP [] _raw_spin_lock_irq+0x15/0x60
    RSP

    The request_queue locking was added because blkcg_gq->refcnt is an int
    protected with the queue lock and __blkg_release_rcu() needs to put
    the parent. Let's fix it by making blkcg_gq->refcnt an atomic_t and
    dropping queue locking in the function.

    Given the general heavy weight of the current request_queue and blkcg
    operations, this is unlikely to cause any noticeable overhead.
    Moreover, blkcg_gq->refcnt is likely to be converted to percpu_ref in
    the near future, so whatever (most likely negligible) overhead it may
    add is temporary.

    Signed-off-by: Tejun Heo
    Reported-by: Joe Lawrence
    Acked-by: Vivek Goyal
    Link: http://lkml.kernel.org/g/alpine.DEB.2.02.1406081816540.17948@jlaw-desktop.mno.stratus.com
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • commit ce36d9ab3bab06b7b5522f5c8b68fac231b76ffb upstream.

    When we SMB3 mounted with mapchars (to allow reserved characters : \ / > < * ?
    via the Unicode Windows to POSIX remap range) empty paths
    (eg when we open "" to query the root of the SMB3 directory on mount) were not
    null terminated so we sent garbarge as a path name on empty paths which caused
    SMB2/SMB2.1/SMB3 mounts to fail when mapchars was specified. mapchars is
    particularly important since Unix Extensions for SMB3 are not supported (yet)

    Signed-off-by: Steve French
    Reviewed-by: David Disseldorp
    Signed-off-by: Greg Kroah-Hartman

    Steve French
     
  • commit a1d0b84c308d7fdfb67eb76498116a6c2fdda507 upstream.

    commit d81b8a40e2ece0a9ab57b1fe1798e291e75bf8fc
    ("CIFS: Cleanup cifs open codepath")
    changed disposition to FILE_OPEN.

    Signed-off-by: Björn Baumbach
    Signed-off-by: Stefan Metzmacher
    Reviewed-by: Stefan Metzmacher
    Cc: Pavel Shilovsky
    Cc: Steve French
    Signed-off-by: Steve French
    Signed-off-by: Greg Kroah-Hartman

    Björn Baumbach
     
  • commit 2fc68eb122c7ea6cd5be1fe7d6650c0beb2f4f40 upstream.

    Support for firmware rev 508+ was added years ago, but we never noticed
    it reports channel in a different way for G-PHY devices. Instead of
    offset from 2400 MHz it simply passes channel id (AKA hw_value).

    So far it was (most probably) affecting monitor mode users only, but
    the following recent commit made it noticeable for quite everybody:

    commit 3afc2167f60a327a2c1e1e2600ef209a3c2b75b7
    Author: Emmanuel Grumbach
    Date: Tue Mar 4 16:50:13 2014 +0200

    cfg80211/mac80211: ignore signal if the frame was heard on wrong channel

    Reported-by: Aaro Koskinen
    Signed-off-by: Rafał Miłecki
    Tested-by: Aaro Koskinen
    Signed-off-by: John W. Linville
    Signed-off-by: Greg Kroah-Hartman

    Rafał Miłecki
     
  • commit b91113282bf44df46aba374a0b8f88a75bfd4b3f upstream.

    If the mdio probe function fails in emac_open, the interrupt we just requested
    isn't freed. If emac_open is called again, for example because we try to set up
    the interface again, the kernel will oops because the interrupt wasn't properly
    released.

    Signed-off-by: Maxime Ripard
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Maxime Ripard
     
  • commit 3906c2b53cd23c2ae03e6ce41432c8e7f0a3cbbb upstream.

    The value of ESR has been stored into x1, and should be directly pass to
    do_sp_pc_abort function, "MOV x1, x25" is an extra operation and do_sp_pc_abort
    will get the wrong value of ESR.

    Signed-off-by: ChiaHao
    Signed-off-by: Catalin Marinas
    Cc:
    Signed-off-by: Greg Kroah-Hartman

    ChiaHao
     
  • commit c021f241f4fab2bb4fc4120a38a828a03dd3f970 upstream.

    Fix a parser-bug in the omap2 muxing code where muxtable-entries will be
    wrongly selected if the requested muxname is a *prefix* of their
    m0-entry and they have a matching mN-entry. Fix by additionally checking
    that the length of the m0_entry is equal.

    For example muxing of "dss_data2.dss_data2" on omap32xx will fail
    because the prefix "dss_data2" will match the mux-entries "dss_data2" as
    well as "dss_data20", with the suffix "dss_data2" matching m0 (for
    dss_data2) and m4 (for dss_data20). Thus both are recognized as signal
    path candidates:

    Relevant muxentries from mux34xx.c:
    _OMAP3_MUXENTRY(DSS_DATA20, 90,
    "dss_data20", NULL, "mcspi3_somi", "dss_data2",
    "gpio_90", NULL, NULL, "safe_mode"),
    _OMAP3_MUXENTRY(DSS_DATA2, 72,
    "dss_data2", NULL, NULL, NULL,
    "gpio_72", NULL, NULL, "safe_mode"),

    This will result in a failure to mux the pin at all:

    _omap_mux_get_by_name: Multiple signal paths (2) for dss_data2.dss_data2

    Patch should apply to linus' latest master down to rather old linux-2.6
    trees.

    Signed-off-by: David R. Piegdon
    Cc: stable@vger.kernel.org
    [tony@atomide.com: updated description to include full description]
    Signed-off-by: Tony Lindgren
    Signed-off-by: Greg Kroah-Hartman

    David R. Piegdon