1. 12 Sep, 2014 40 commits
    • Michael Neuling's avatar
      powerpc/signals: Mark VSX not saved with small contexts · 80832769
      Michael Neuling authored
      commit c13f20ac upstream.
      
      The VSX MSR bit in the user context indicates if the context contains VSX
      state.  Currently we set this when the process has touched VSX at any stage.
      
      Unfortunately, if the user has not provided enough space to save the VSX state,
      we can't save it but we currently still set the MSR VSX bit.
      
      This patch changes this to clear the MSR VSX bit when the user doesn't provide
      enough space.  This indicates that there is no valid VSX state in the user
      context.
      
      This is needed to support get/set/make/swapcontext for applications that use
      VSX but only provide a small context.  For example, getcontext in glibc
      provides a smaller context since the VSX registers don't need to be saved over
      the glibc function call.  But since the program calling getcontext may have
      used VSX, the kernel currently says the VSX state is valid when it's not.  If
      the returned context is then used in setcontext (ie. a small context without
      VSX but with MSR VSX set), the kernel will refuse the context.  This situation
      has been reported by the glibc community.
      
      Based on patch from Carlos O'Donell.
      Tested-by: default avatarHaren Myneni <haren@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit 3bf4e8c8)
      80832769
    • Huang Shijie's avatar
      mtd: gpmi: fix kernel BUG due to racing DMA operations · 8cc739b3
      Huang Shijie authored
      [1] The gpmi uses the nand_command_lp to issue the commands to NAND chips.
          The gpmi issues a DMA operation with gpmi_cmd_ctrl when it handles
          a NAND_CMD_NONE control command. So when we read a page(NAND_CMD_READ0)
          from the NAND, we may send two DMA operations back-to-back.
      
          If we do not serialize the two DMA operations, we will meet a bug when
      
          1.1) we enable CONFIG_DMA_API_DEBUG, CONFIG_DMADEVICES_DEBUG,
               and CONFIG_DEBUG_SG.
      
          1.2) Use the following commands in an UART console and a SSH console:
               cmd 1: while true;do dd if=/dev/mtd0 of=/dev/null;done
               cmd 1: while true;do dd if=/dev/mmcblk0 of=/dev/null;done
      
          The kernel log shows below:
          -----------------------------------------------------------------
          kernel BUG at lib/scatterlist.c:28!
          Unable to handle kernel NULL pointer dereference at virtual address 00000000
            .........................
          [<80044a0c>] (__bug+0x18/0x24) from [<80249b74>] (sg_next+0x48/0x4c)
          [<80249b74>] (sg_next+0x48/0x4c) from [<80255398>] (debug_dma_unmap_sg+0x170/0x1a4)
          [<80255398>] (debug_dma_unmap_sg+0x170/0x1a4) from [<8004af58>] (dma_unmap_sg+0x14/0x6c)
          [<8004af58>] (dma_unmap_sg+0x14/0x6c) from [<8027e594>] (mxs_dma_tasklet+0x18/0x1c)
          [<8027e594>] (mxs_dma_tasklet+0x18/0x1c) from [<8007d444>] (tasklet_action+0x114/0x164)
          -----------------------------------------------------------------
      
          1.3) Assume the two DMA operations is X (first) and Y (second).
      
               The root cause of the bug:
      	   Assume process P issues DMA X, and sleep on the completion
      	 @this->dma_done. X's tasklet callback is dma_irq_callback. It firstly
      	 wake up the process sleeping on the completion @this->dma_done,
      	 and then trid to unmap the scatterlist S. The waked process P will
      	 issue Y in another ARM core. Y initializes S->sg_magic to zero
      	 with sg_init_one(), while dma_irq_callback is unmapping S at the same
      	 time.
      
      	 See the diagram:
      
                         ARM core 0              |         ARM core 1
      	 -------------------------------------------------------------
               (P issues DMA X, then sleep)  --> |
                                                 |
               (X's tasklet wakes P)         --> |
                                                 |
                                                 | <-- (P begin to issue DMA Y)
                                                 |
               (X's tasklet unmap the            |
            scatterlist S with dma_unmap_sg) --> | <-- (Y calls sg_init_one() to init
                                                 |      scatterlist S)
                                                 |
      
      [2] This patch serialize both the X and Y in the following way:
           Unmap the DMA scatterlist S firstly, and wake up the process at the end
           of the DMA callback, in such a way, Y will be executed after X.
      
           After this patch:
      
                         ARM core 0              |         ARM core 1
      	 -------------------------------------------------------------
               (P issues DMA X, then sleep)  --> |
                                                 |
               (X's tasklet unmap the            |
            scatterlist S with dma_unmap_sg) --> |
                                                 |
               (X's tasklet wakes P)         --> |
                                                 |
                                                 | <-- (P begin to issue DMA Y)
                                                 |
                                                 | <-- (Y calls sg_init_one() to init
                                                 |     scatterlist S)
                                                 |
      
      Cc: stable@vger.kernel.org # 3.2
      Signed-off-by: default avatarHuang Shijie <b32955@freescale.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      
      (cherry picked from commit 7b3d2fb9)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8cc739b3
    • Larry Finger's avatar
      rtlwifi: rtl8192se: Fix incorrect signal strength for unassociated AP · cc919791
      Larry Finger authored
      The routine that processes received frames was returning the RSSI value for the
      signal strength; however, that value is available only for associated APs. As
      a result, the strength was the absurd value of 10 dBm. As a result, scans
      return incorrect values for the strength, which causes unwanted attempts to roam.
      
      This patch fixes https://bugzilla.kernel.org/show_bug.cgi?id=63881.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Reported-by: default avatarMatthieu Baerts <matttbe@gmail.com>
      Cc: Stable <stable@vger.kernel.org> [3.0 +]
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit b4ade797)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      cc919791
    • KOSAKI Motohiro's avatar
      alarmtimer: return EINVAL instead of ENOTSUPP if rtcdev doesn't exist · 9b160ac0
      KOSAKI Motohiro authored
      Fedora Ruby maintainer reported latest Ruby doesn't work on Fedora Rawhide
      on ARM. (http://bugs.ruby-lang.org/issues/9008)
      
      Because of, commit 1c6b39ad (alarmtimers: Return -ENOTSUPP if no
      RTC device is present) intruduced to return ENOTSUPP when
      clock_get{time,res} can't find a RTC device. However this is incorrect.
      
      First, ENOTSUPP isn't exported to userland (ENOTSUP or EOPNOTSUP are the
      closest userland equivlents).
      
      Second, Posix and Linux man pages agree that clock_gettime and
      clock_getres should return EINVAL if clk_id argument is invalid.
      While the arugment that the clockid is valid, but just not supported
      on this hardware could be made, this is just a technicality that
      doesn't help userspace applicaitons, and only complicates error
      handling.
      
      Thus, this patch changes the code to use EINVAL.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: stable <stable@vger.kernel.org>  #3.0 and up
      Reported-by: default avatarVit Ondruch <v.ondruch@tiscali.cz>
      Signed-off-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      [jstultz: Tweaks to commit message to include full rational]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      
      (cherry picked from commit 98d6f4dd)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9b160ac0
    • Fan Du's avatar
      include/linux/fs.h: disable preempt when acquire i_size_seqcount write lock · 82c8f2d3
      Fan Du authored
      Two rt tasks bind to one CPU core.
      
      The higher priority rt task A preempts a lower priority rt task B which
      has already taken the write seq lock, and then the higher priority rt
      task A try to acquire read seq lock, it's doomed to lockup.
      
      rt task A with lower priority: call write
      i_size_write                                        rt task B with higher priority: call sync, and preempt task A
        write_seqcount_begin(&inode->i_size_seqcount);    i_size_read
        inode->i_size = i_size;                             read_seqcount_begin <-- lockup here...
      
      So disable preempt when acquiring every i_size_seqcount *write* lock will
      cure the problem.
      Signed-off-by: default avatarFan Du <fan.du@windriver.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 74e3d1e1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      82c8f2d3
    • Steven Rostedt's avatar
      tracing: Fix potential out-of-bounds in trace_get_user() · 6b1744a1
      Steven Rostedt authored
      Andrey reported the following report:
      
      ERROR: AddressSanitizer: heap-buffer-overflow on address ffff8800359c99f3
      ffff8800359c99f3 is located 0 bytes to the right of 243-byte region [ffff8800359c9900, ffff8800359c99f3)
      Accessed by thread T13003:
        #0 ffffffff810dd2da (asan_report_error+0x32a/0x440)
        #1 ffffffff810dc6b0 (asan_check_region+0x30/0x40)
        #2 ffffffff810dd4d3 (__tsan_write1+0x13/0x20)
        #3 ffffffff811cd19e (ftrace_regex_release+0x1be/0x260)
        #4 ffffffff812a1065 (__fput+0x155/0x360)
        #5 ffffffff812a12de (____fput+0x1e/0x30)
        #6 ffffffff8111708d (task_work_run+0x10d/0x140)
        #7 ffffffff810ea043 (do_exit+0x433/0x11f0)
        #8 ffffffff810eaee4 (do_group_exit+0x84/0x130)
        #9 ffffffff810eafb1 (SyS_exit_group+0x21/0x30)
        #10 ffffffff81928782 (system_call_fastpath+0x16/0x1b)
      
      Allocated by thread T5167:
        #0 ffffffff810dc778 (asan_slab_alloc+0x48/0xc0)
        #1 ffffffff8128337c (__kmalloc+0xbc/0x500)
        #2 ffffffff811d9d54 (trace_parser_get_init+0x34/0x90)
        #3 ffffffff811cd7b3 (ftrace_regex_open+0x83/0x2e0)
        #4 ffffffff811cda7d (ftrace_filter_open+0x2d/0x40)
        #5 ffffffff8129b4ff (do_dentry_open+0x32f/0x430)
        #6 ffffffff8129b668 (finish_open+0x68/0xa0)
        #7 ffffffff812b66ac (do_last+0xb8c/0x1710)
        #8 ffffffff812b7350 (path_openat+0x120/0xb50)
        #9 ffffffff812b8884 (do_filp_open+0x54/0xb0)
        #10 ffffffff8129d36c (do_sys_open+0x1ac/0x2c0)
        #11 ffffffff8129d4b7 (SyS_open+0x37/0x50)
        #12 ffffffff81928782 (system_call_fastpath+0x16/0x1b)
      
      Shadow bytes around the buggy address:
        ffff8800359c9700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        ffff8800359c9780: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
        ffff8800359c9800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>ffff8800359c9980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[03]fb
        ffff8800359c9a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9b00: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
        ffff8800359c9b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        ffff8800359c9c00: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07
        Heap redzone:          fa
        Heap kmalloc redzone:  fb
        Freed heap region:     fd
        Shadow gap:            fe
      
      The out-of-bounds access happens on 'parser->buffer[parser->idx] = 0;'
      
      Although the crash happened in ftrace_regex_open() the real bug
      occurred in trace_get_user() where there's an incrementation to
      parser->idx without a check against the size. The way it is triggered
      is if userspace sends in 128 characters (EVENT_BUF_SIZE + 1), the loop
      that reads the last character stores it and then breaks out because
      there is no more characters. Then the last character is read to determine
      what to do next, and the index is incremented without checking size.
      
      Then the caller of trace_get_user() usually nulls out the last character
      with a zero, but since the index is equal to the size, it writes a nul
      character after the allocated space, which can corrupt memory.
      
      Luckily, only root user has write access to this file.
      
      Link: http://lkml.kernel.org/r/20131009222323.04fd1a0d@gandalf.local.homeReported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit 057db848)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6b1744a1
    • Eric Dumazet's avatar
      bnx2x: record rx queue for LRO packets · e1a30afb
      Eric Dumazet authored
      RPS support is kind of broken on bnx2x, because only non LRO packets
      get proper rx queue information. This triggers reorders, as it seems
      bnx2x like to generate a non LRO packet for segment including TCP PUSH
      flag : (this might be pure coincidence, but all the reorders I've
      seen involve segments with a PUSH)
      
      11:13:34.335847 IP A > B: . 415808:447136(31328) ack 1 win 457 <nop,nop,timestamp 3789336 3985797>
      11:13:34.335992 IP A > B: . 447136:448560(1424) ack 1 win 457 <nop,nop,timestamp 3789336 3985797>
      11:13:34.336391 IP A > B: . 448560:479888(31328) ack 1 win 457 <nop,nop,timestamp 3789337 3985797>
      11:13:34.336425 IP A > B: P 511216:512640(1424) ack 1 win 457 <nop,nop,timestamp 3789337 3985798>
      11:13:34.336423 IP A > B: . 479888:511216(31328) ack 1 win 457 <nop,nop,timestamp 3789337 3985798>
      11:13:34.336924 IP A > B: . 512640:543968(31328) ack 1 win 457 <nop,nop,timestamp 3789337 3985798>
      11:13:34.336963 IP A > B: . 543968:575296(31328) ack 1 win 457 <nop,nop,timestamp 3789337 3985798>
      
      We must call skb_record_rx_queue() to properly give to RPS (and more
      generally for TX queue selection on forward path) the receive queue
      information.
      
      Similar fix is needed for skb_mark_napi_id(), but will be handled
      in a separate patch to ease stable backports.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Cc: Eilon Greenstein <eilong@broadcom.com>
      Acked-by: default avatarDmitry Kravkov <dmitry@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit 60e66fee)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      e1a30afb
    • David Rientjes's avatar
      mm, show_mem: suppress page counts in non-blockable contexts · 358fb3db
      David Rientjes authored
      On large systems with a lot of memory, walking all RAM to determine page
      types may take a half second or even more.
      
      In non-blockable contexts, the page allocator will emit a page allocation
      failure warning unless __GFP_NOWARN is specified.  In such contexts, irqs
      are typically disabled and such a lengthy delay may even result in NMI
      watchdog timeouts.
      
      To fix this, suppress the page walk in such contexts when printing the
      page allocation failure warning.
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: Dave Hansen <dave@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 4b59e6c4)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      358fb3db
    • Lv Zheng's avatar
      ACPI / IPMI: Fix atomic context requirement of ipmi_msg_handler() · 989cd70e
      Lv Zheng authored
      This patch fixes the issues indicated by the test results that
      ipmi_msg_handler() is invoked in atomic context.
      
      BUG: scheduling while atomic: kipmi0/18933/0x10000100
      Modules linked in: ipmi_si acpi_ipmi ...
      CPU: 3 PID: 18933 Comm: kipmi0 Tainted: G       AW    3.10.0-rc7+ #2
      Hardware name: QCI QSSC-S4R/QSSC-S4R, BIOS QSSC-S4R.QCI.01.00.0027.070120100606 07/01/2010
       ffff8838245eea00 ffff88103fc63c98 ffffffff814c4a1e ffff88103fc63ca8
       ffffffff814bfbab ffff88103fc63d28 ffffffff814c73e0 ffff88103933cbd4
       0000000000000096 ffff88103fc63ce8 ffff88102f618000 ffff881035c01fd8
      Call Trace:
       <IRQ>  [<ffffffff814c4a1e>] dump_stack+0x19/0x1b
       [<ffffffff814bfbab>] __schedule_bug+0x46/0x54
       [<ffffffff814c73e0>] __schedule+0x83/0x59c
       [<ffffffff81058853>] __cond_resched+0x22/0x2d
       [<ffffffff814c794b>] _cond_resched+0x14/0x1d
       [<ffffffff814c6d82>] mutex_lock+0x11/0x32
       [<ffffffff8101e1e9>] ? __default_send_IPI_dest_field.constprop.0+0x53/0x58
       [<ffffffffa09e3f9c>] ipmi_msg_handler+0x23/0x166 [ipmi_si]
       [<ffffffff812bf6e4>] deliver_response+0x55/0x5a
       [<ffffffff812c0fd4>] handle_new_recv_msgs+0xb67/0xc65
       [<ffffffff81007ad1>] ? read_tsc+0x9/0x19
       [<ffffffff814c8620>] ? _raw_spin_lock_irq+0xa/0xc
       [<ffffffffa09e1128>] ipmi_thread+0x5c/0x146 [ipmi_si]
       ...
      
      Also Tony Camuso says:
      
       We were getting occasional "Scheduling while atomic" call traces
       during boot on some systems. Problem was first seen on a Cisco C210
       but we were able to reproduce it on a Cisco c220m3. Setting
       CONFIG_LOCKDEP and LOCKDEP_SUPPORT to 'y' exposed a lockdep around
       tx_msg_lock in acpi_ipmi.c struct acpi_ipmi_device.
      
       =================================
       [ INFO: inconsistent lock state ]
       2.6.32-415.el6.x86_64-debug-splck #1
       ---------------------------------
       inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
       ksoftirqd/3/17 [HC0[0]:SC1[1]:HE1:SE0] takes:
        (&ipmi_device->tx_msg_lock){+.?...}, at: [<ffffffff81337a27>] ipmi_msg_handler+0x71/0x126
       {SOFTIRQ-ON-W} state was registered at:
         [<ffffffff810ba11c>] __lock_acquire+0x63c/0x1570
         [<ffffffff810bb0f4>] lock_acquire+0xa4/0x120
         [<ffffffff815581cc>] __mutex_lock_common+0x4c/0x400
         [<ffffffff815586ea>] mutex_lock_nested+0x4a/0x60
         [<ffffffff8133789d>] acpi_ipmi_space_handler+0x11b/0x234
         [<ffffffff81321c62>] acpi_ev_address_space_dispatch+0x170/0x1be
      
      The fix implemented by this change has been tested by Tony:
      
       Tested the patch in a boot loop with lockdep debug enabled and never
       saw the problem in over 400 reboots.
      Reported-and-tested-by: default avatarTony Camuso <tcamuso@redhat.com>
      Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Reviewed-by: default avatarHuang Ying <ying.huang@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      
      (cherry picked from commit 06a8566b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      989cd70e
    • Ben Hutchings's avatar
      Revert "sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()" · 09277c82
      Ben Hutchings authored
      This reverts commit de77b795, which was
      commit f6e80abe upstream.
      
      This fix was only appropriate for Linux 3.7 onward, and introduced a
      regression when applied to earlier versions.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit 177c417c)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      09277c82
    • Jan Kara's avatar
      isofs: Refuse RW mount of the filesystem instead of making it RO · 50b747d4
      Jan Kara authored
      Refuse RW mount of isofs filesystem. So far we just silently changed it
      to RO mount but when the media is writeable, block layer won't notice
      this change and thus will think device is used RW and will block eject
      button of the drive. That is unexpected by users because for
      non-writeable media eject button works just fine.
      
      Userspace mount(8) command handles this just fine and retries mounting
      with MS_RDONLY set so userspace shouldn't see any regression.  Plus any
      tool mounting isofs is likely confronted with the case of read-only
      media where block layer already refuses to mount the filesystem without
      MS_RDONLY set so our behavior shouldn't be anything new for it.
      Reported-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      
      (cherry picked from commit 17b7f7cf)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      50b747d4
    • Stefan Kriwanek's avatar
      HID: Fix Speedlink VAD Cezanne support for some devices · 833497ab
      Stefan Kriwanek authored
      Some devices of the "Speedlink VAD Cezanne" model need more aggressive fixing
      than already done.
      
      I made sure through testing that this patch would not interfere with the proper
      working of a device that is bug-free. (The driver drops EV_REL events with
      abs(val) >= 256, which are not achievable even on the highest laser resolution
      hardware setting.)
      Signed-off-by: default avatarStefan Kriwanek <mail@stefankriwanek.de>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      
      (cherry picked from commit 06bb5219)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      833497ab
    • Andi Kleen's avatar
      perf tools: Handle JITed code in shared memory · 912eb640
      Andi Kleen authored
      Need to check for /dev/zero.
      
      Most likely more strings are missing too.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/1366848182-30449-1-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      
      (cherry picked from commit 89365e6c)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      912eb640
    • Li Zefan's avatar
      cgroup: fail if monitored file and event_control are in different cgroup · d3355484
      Li Zefan authored
      If we pass fd of memory.usage_in_bytes of cgroup A to cgroup.event_control
      of cgroup B, then we won't get memory usage notification from A but B!
      
      What's worse, if A and B are in different mount hierarchy, we'll end up
      accessing NULL pointer!
      
      Disallow this kind of invalid usage.
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarKirill A. Shutemov <kirill@shutemov.name>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      
      (cherry picked from commit f169007b)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d3355484
    • Ben Hutchings's avatar
      sfc: Fix efx_rx_buf_offset() for recycled pages · 30453237
      Ben Hutchings authored
      This bug fix is only for stable branches older than 3.10.  The bug was
      fixed upstream by commit 2768935a ('sfc: reuse pages to avoid DMA
      mapping/unmapping costs'), but that change is totally unsuitable for
      stable.
      
      Commit b590ace0 ('sfc: Fix efx_rx_buf_offset() in the presence of
      swiotlb') added an explicit page_offset member to struct
      efx_rx_buffer, which must be set consistently with the u.page and
      dma_addr fields.  However, it failed to add the necessary assignment
      in efx_resurrect_rx_buffer().  It also did not correct the calculation
      of efx_rx_buffer::dma_addr in efx_resurrect_rx_buffer(), which assumes
      that DMA-mapping a page will result in a page-aligned DMA address
      (exactly what swiotlb violates).
      
      Add the assignment of efx_rx_buffer::page_offset and change the
      calculation of dma_addr to make use of it.
      Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
      (cherry picked from commit 5f7f65da)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      30453237
    • Ben Hutchings's avatar
      Revert "zram: use zram->lock to protect zram_free_page() in swap free notify path" · 6bebf7d7
      Ben Hutchings authored
      This reverts commit 9e443904, which
      was commit 57ab0485 upstream.
      
      Taking the semaphore here leads to sleeping in atomic context.  This
      was fixed in mainline commit a0c516cb ("zram: don't grab mutex in
      zram_slot_free_noity") but that is too difficult to backport.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit 98ed9120)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      6bebf7d7
    • Oleg Nesterov's avatar
      debugfs: debugfs_remove_recursive() must not rely on list_empty(d_subdirs) · 9b97f236
      Oleg Nesterov authored
      debugfs_remove_recursive() is wrong,
      
      1. it wrongly assumes that !list_empty(d_subdirs) means that this
         dir should be removed.
      
         This is not that bad by itself, but:
      
      2. if d_subdirs does not becomes empty after __debugfs_remove()
         it gives up and silently fails, it doesn't even try to remove
         other entries.
      
         However ->d_subdirs can be non-empty because it still has the
         already deleted !debugfs_positive() entries.
      
      3. simple_release_fs() is called even if __debugfs_remove() fails.
      
      Suppose we have
      
      	dir1/
      		dir2/
      			file2
      		file1
      
      and someone opens dir1/dir2/file2.
      
      Now, debugfs_remove_recursive(dir1/dir2) succeeds, and dir1/dir2 goes
      away.
      
      But debugfs_remove_recursive(dir1) silently fails and doesn't remove
      this directory. Because it tries to delete (the already deleted)
      dir1/dir2/file2 again and then fails due to "Avoid infinite loop"
      logic.
      
      Test-case:
      
      	#!/bin/sh
      
      	cd /sys/kernel/debug/tracing
      	echo 'p:probe/sigprocmask sigprocmask' >> kprobe_events
      	sleep 1000 < events/probe/sigprocmask/id &
      	echo -n >| kprobe_events
      
      	[ -d events/probe ] && echo "ERR!! failed to rm probe"
      
      And after that it is not possible to create another probe entry.
      
      With this patch debugfs_remove_recursive() skips !debugfs_positive()
      files although this is not strictly needed. The most important change
      is that it does not try to make ->d_subdirs empty, it simply scans
      the whole list(s) recursively and removes as much as possible.
      
      Link: http://lkml.kernel.org/r/20130726151256.GC19472@redhat.comAcked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit 776164c1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      9b97f236
    • Stanislaw Gruszka's avatar
      rt2800: fix wrong TX power compensation · a17883ef
      Stanislaw Gruszka authored
      We should not do temperature compensation on devices without
      EXTERNAL_TX_ALC bit set (called DynamicTxAgcControl on vendor driver).
      Such devices can have totally bogus TSSI parameters on the EEPROM,
      but still threaded by us as valid and result doing wrong TX power
      calculations.
      
      This fix inability to connect to AP on slightly longer distance on
      some Ralink chips/devices.
      Reported-and-tested-by: default avatarFabien ADAM <id2ndr@crocobox.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      
      (cherry picked from commit 6e956da2)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a17883ef
    • David Vrabel's avatar
      x86/xen: do not identity map UNUSABLE regions in the machine E820 · 4123a357
      David Vrabel authored
      If there are UNUSABLE regions in the machine memory map, dom0 will
      attempt to map them 1:1 which is not permitted by Xen and the kernel
      will crash.
      
      There isn't anything interesting in the UNUSABLE region that the dom0
      kernel needs access to so we can avoid making the 1:1 mapping and
      treat it as RAM.
      
      We only do this for dom0, as that is where tboot case shows up.
      A PV domU could have an UNUSABLE region in its pseudo-physical map
      and would need to be handled in another patch.
      
      This fixes a boot failure on hosts with tboot.
      
      tboot marks a region in the e820 map as unusable and the dom0 kernel
      would attempt to map this region and Xen does not permit unusable
      regions to be mapped by guests.
      
        (XEN)  0000000000000000 - 0000000000060000 (usable)
        (XEN)  0000000000060000 - 0000000000068000 (reserved)
        (XEN)  0000000000068000 - 000000000009e000 (usable)
        (XEN)  0000000000100000 - 0000000000800000 (usable)
        (XEN)  0000000000800000 - 0000000000972000 (unusable)
      
      tboot marked this region as unusable.
      
        (XEN)  0000000000972000 - 00000000cf200000 (usable)
        (XEN)  00000000cf200000 - 00000000cf38f000 (reserved)
        (XEN)  00000000cf38f000 - 00000000cf3ce000 (ACPI data)
        (XEN)  00000000cf3ce000 - 00000000d0000000 (reserved)
        (XEN)  00000000e0000000 - 00000000f0000000 (reserved)
        (XEN)  00000000fe000000 - 0000000100000000 (reserved)
        (XEN)  0000000100000000 - 0000000630000000 (usable)
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      [v1: Altered the patch and description with domU's with UNUSABLE regions]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      
      (cherry picked from commit 3bc38cbc)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4123a357
    • David S. Miller's avatar
      sparc32: Add ucmpdi2.o to obj-y instead of lib-y. · 58033527
      David S. Miller authored
      Otherwise if no references exist in the static kernel image,
      we won't export the symbol properly to modules.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit 74c7b289)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      58033527
    • Sam Ravnborg's avatar
      sparc32: add ucmpdi2 · 19efff36
      Sam Ravnborg authored
      Based on copy from microblaze add ucmpdi2 implementation.
      This fixes build of niu driver which failed with:
      
      drivers/built-in.o: In function `niu_get_nfc':
      niu.c:(.text+0x91494): undefined reference to `__ucmpdi2'
      
      This driver will never be used on a sparc32 system,
      but patch added to fix build breakage with all*config builds.
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit de36e66d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      19efff36
    • Will Deacon's avatar
      alpha: makefile: don't enforce small data model for kernel builds · 3b9838db
      Will Deacon authored
      Due to all of the goodness being packed into today's kernels, the
      resulting image isn't as slim as it once was.
      
      In light of this, don't pass -msmall-data to gcc, which otherwise results
      in link failures due to impossible relocations when compiling anything but
      the most trivial configurations.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
      Tested-by: default avatarThorsten Kranzkowski <dl8bcu@dl8bcu.de>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMichael Cree <mcree@orcon.net.nz>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit cd8d2331)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      3b9838db
    • Paul Bolle's avatar
      sound: Fix make allmodconfig on MIPS correctly · 072b8ea5
      Paul Bolle authored
      Commit d4702b18 ("sound: Fix make allmodconfig on MIPS") added a
      (negative) dependency on ISA_DMA_SUPPORT_BROKEN. Since that Kconfig
      symbol doesn't exist, this dependency will always evaluate to true.
      Apparently GENERIC_ISA_DMA_SUPPORT_BROKEN was meant to be used here.
      Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      
      (cherry picked from commit a62ee234)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      072b8ea5
    • Takashi Iwai's avatar
      sound: Fix make allmodconfig on MIPS · 5ad3559b
      Takashi Iwai authored
      commit d4702b18 upstream.
      
      The compile of soundcard.c is broken on MIPS when allmodconfig is used
      because of the missing MAX_DMA_CHANNELS definition.  As a simple
      workaround, just add a Kconfig dependency.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit b0538b44)
      5ad3559b
    • Arnd Bergmann's avatar
      SCSI: nsp32: use mdelay instead of large udelay constants · 0552d3e4
      Arnd Bergmann authored
      commit b497ceb9 upstream.
      
      ARM cannot handle udelay for more than 2 miliseconds, so we
      should use mdelay instead for those.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarGOTO Masanori <gotom@debian.or.jp>
      Cc: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit 6d9ca51b)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0552d3e4
    • Ben Hutchings's avatar
      Revert "PM / Domains: Fix handling of wakeup devices during system resume" · 0326df5f
      Ben Hutchings authored
      This reverts commit 5c6156fa, which
      was commit cc85b207 upstream.
      
      It broke ARM && PM configurations by adding a call to
      genpd_dev_active_wakeup() which was only added in Linux 3.3.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit 3c19c6a8)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      0326df5f
    • Martin Peschke's avatar
      [SCSI] zfcp: fix lock imbalance by reworking request queue locking · bbc9a3c8
      Martin Peschke authored
      This patch adds wait_event_interruptible_lock_irq_timeout(), which is a
      straight-forward descendant of wait_event_interruptible_timeout() and
      wait_event_interruptible_lock_irq().
      
      The zfcp driver used to call wait_event_interruptible_timeout()
      in combination with some intricate and error-prone locking. Using
      wait_event_interruptible_lock_irq_timeout() as a replacement
      nicely cleans up that locking.
      
      This rework removes a situation that resulted in a locking imbalance
      in zfcp_qdio_sbal_get():
      
      BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
          last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]
      
      It was introduced by commit c2af7545
      "[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new
      code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit
      without a required lock being held. The problem occured when a
      special, non-SCSI I/O request was being submitted in process context,
      when the adapter's queues had been torn down. In this case the bug
      surfaced when the Fibre Channel port connection for a well-known address
      was closed during a concurrent adapter shut-down procedure, which is a
      rare constellation.
      
      This patch also fixes these warnings from the sparse tool (make C=1):
      
      drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
       'zfcp_qdio_sbal_check' - wrong count at exit
      drivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
       'zfcp_qdio_sbal_get' - unexpected unlock
      
      Last but not least, we get rid of that crappy lock-unlock-lock
      sequence at the beginning of the critical section.
      
      It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.
      Reported-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Reported-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Peschke <mpeschke@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org #2.6.35+
      Signed-off-by: default avatarSteffen Maier <maier@linux.vnet.ibm.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      
      (cherry picked from commit d79ff142)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      bbc9a3c8
    • Andrew Vagin's avatar
      tracing: Fix fields of struct trace_iterator that are zeroed by mistake · 775a7e94
      Andrew Vagin authored
      tracing_read_pipe zeros all fields bellow "seq". The declaration contains
      a comment about that, but it doesn't help.
      
      The first field is "snapshot", it's true when current open file is
      snapshot. Looks obvious, that it should not be zeroed.
      
      The second field is "started". It was converted from cpumask_t to
      cpumask_var_t (v2.6.28-4983-g4462344e), in other words it was
      converted from cpumask to pointer on cpumask.
      
      Currently the reference on "started" memory is lost after the first read
      from tracing_read_pipe and a proper object will never be freed.
      
      The "started" is never dereferenced for trace_pipe, because trace_pipe
      can't have the TRACE_FILE_ANNOTATE options.
      
      Link: http://lkml.kernel.org/r/1375463803-3085183-1-git-send-email-avagin@openvz.org
      
      Cc: stable@vger.kernel.org # 2.6.30
      Signed-off-by: default avatarAndrew Vagin <avagin@openvz.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      
      (cherry picked from commit ed5467da)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      775a7e94
    • Amit Shah's avatar
      virtio: console: clean up port data immediately at time of unplug · 57c2565c
      Amit Shah authored
      We used to keep the port's char device structs and the /sys entries
      around till the last reference to the port was dropped.  This is
      actually unnecessary, and resulted in buggy behaviour:
      
      1. Open port in guest
      2. Hot-unplug port
      3. Hot-plug a port with the same 'name' property as the unplugged one
      
      This resulted in hot-plug being unsuccessful, as a port with the same
      name already exists (even though it was unplugged).
      
      This behaviour resulted in a warning message like this one:
      
      -------------------8<---------------------------------------
      WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
      Hardware name: KVM
      sysfs: cannot create duplicate filename
      '/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'
      
      Call Trace:
       [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0
       [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50
       [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130
       [<ffffffff811f23e8>] ? create_dir+0x68/0xb0
       [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50
       [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260
       [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60
       [<ffffffff812734b4>] ? kobject_add+0x44/0x70
       [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0
       [<ffffffff8134b389>] ? device_add+0xc9/0x650
      
      -------------------8<---------------------------------------
      
      Instead of relying on guest applications to release all references to
      the ports, we should go ahead and unregister the port from all the core
      layers.  Any open/read calls on the port will then just return errors,
      and an unplug/plug operation on the host will succeed as expected.
      
      This also caused buggy behaviour in case of the device removal (not just
      a port): when the device was removed (which means all ports on that
      device are removed automatically as well), the ports with active
      users would clean up only when the last references were dropped -- and
      it would be too late then to be referencing char device pointers,
      resulting in oopses:
      
      -------------------8<---------------------------------------
      PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
       #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
       #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
       #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
       #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
       #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
       #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
          [exception RIP: strlen+2]
          RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
          RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
          RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
          RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
          R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
          R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
       #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
       #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
       #9 [ffff88011b9d5de0] device_del at ffffffff813440c7
      
      -------------------8<---------------------------------------
      
      So clean up when we have all the context, and all that's left to do when
      the references to the port have dropped is to free up the port struct
      itself.
      
      CC: <stable@vger.kernel.org>
      Reported-by: default avatarchayang <chayang@redhat.com>
      Reported-by: default avatarYOGANANTH SUBRAMANIAN <anantyog@in.ibm.com>
      Reported-by: default avatarFuXiangChun <xfu@redhat.com>
      Reported-by: default avatarQunfang Zhang <qzhang@redhat.com>
      Reported-by: default avatarSibiao Luo <sluo@redhat.com>
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      
      (cherry picked from commit ea3768b4)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      57c2565c
    • Linus Torvalds's avatar
      vm: add no-mmu vm_iomap_memory() stub · 81c85eb4
      Linus Torvalds authored
      I think we could just move the full vm_iomap_memory() function into
      util.h or similar, but I didn't get any reply from anybody actually
      using nommu even to this trivial patch, so I'm not going to touch it any
      more than required.
      
      Here's the fairly minimal stub to make the nommu case at least
      potentially work.  It doesn't seem like anybody cares, though.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      
      (cherry picked from commit 3c0b9de6)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      81c85eb4
    • Dave Kleikamp's avatar
      jfs: fix readdir cookie incompatibility with NFSv4 · d8a4c8b2
      Dave Kleikamp authored
      NFSv4 reserves readdir cookie values 0-2 for special entries (. and ..),
      but jfs allows a value of 2 for a non-special entry. This incompatibility
      can result in the nfs client reporting a readdir loop.
      
      This patch doesn't change the value stored internally, but adds one to
      the value exposed to the iterate method.
      Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
      Tested-by: default avatarChristian Kujau <lists@nerdbynature.de>
      
      (cherry picked from commit 44512449)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d8a4c8b2
    • Joshua Zhu's avatar
      perf tools: Add anonymous huge page recognition · a2e8e658
      Joshua Zhu authored
      Judging anonymous memory's vm_area_struct, perf_mmap_event's filename
      will be set to "//anon" indicating this vma belongs to anonymous
      memory.
      
      Once hugepage is used, vma's vm_file points to hugetlbfs. In this way,
      this vma will not be regarded as anonymous memory by is_anon_memory() in
      perf user space utility.
      Signed-off-by: default avatarJoshua Zhu <zhu.wen-jie@hp.com>
      Cc: Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joshua Zhu <zhu.wen-jie@hp.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1357363797-3550-1-git-send-email-zhu.wen-jie@hp.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      
      (cherry picked from commit d0528b5d)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      a2e8e658
    • Tejun Heo's avatar
      libata: make it clear that sata_inic162x is experimental · 8e2f67fc
      Tejun Heo authored
      sata_inic162x never reached a state where it's reliable enough for
      production use and data corruption is a relatively common occurrence.
      Make the driver generate warning about the issues and mark the Kconfig
      option as experimental.
      
      If the situation doesn't improve, we'd be better off making it depend
      on CONFIG_BROKEN.  Let's wait for several cycles and see if the kernel
      message draws any attention.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarMartin Braure de Calignon <braurede@free.fr>
      Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Reported-by: risc4all@yahoo.com
      
      (cherry picked from commit bb969619)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8e2f67fc
    • Ben Hutchings's avatar
      ifb: Include <linux/sched.h> · 32a40775
      Ben Hutchings authored
      commit b51c3427 ('ifb: fix rcu_sched self-detected stalls', commit
      440d57bc upstream) added a call to cond_resched(), which is
      declared in '#include <linux/sched.h>'.  In Linux 3.2.y that header is
      included indirectly in some but not all configurations, so add a
      direct #include.
      Reported-by: default avatarTeck Choon Giam <giamteckchoon@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      (cherry picked from commit 22cbb1bd)
      
      (cherry picked from commit HEAD)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      32a40775
    • David S. Miller's avatar
      sparc64: Do not insert non-valid PTEs into the TSB hash table. · 866c34a1
      David S. Miller authored
      The assumption was that update_mmu_cache() (and the equivalent for PMDs) would
      only be called when the PTE being installed will be accessible by the user.
      
      This is not true for code paths originating from remove_migration_pte().
      
      There are dire consequences for placing a non-valid PTE into the TSB.  The TLB
      miss frramework assumes thatwhen a TSB entry matches we can just load it into
      the TLB and return from the TLB miss trap.
      
      So if a non-valid PTE is in there, we will deadlock taking the TLB miss over
      and over, never satisfying the miss.
      
      Just exit early from update_mmu_cache() and friends in this situation.
      
      Based upon a report and patch from Christopher Alexander Tobias Schulze.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      
      (cherry picked from commit 18f38132)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      866c34a1
    • H. Peter Anvin's avatar
      x86, espfix: Make espfix64 a Kconfig option, fix UML · 8461e05f
      H. Peter Anvin authored
      Make espfix64 a hidden Kconfig option.  This fixes the x86-64 UML
      build which had broken due to the non-existence of init_espfix_bsp()
      in UML: since UML uses its own Kconfig, this option does not appear in
      the UML build.
      
      This also makes it possible to make support for 16-bit segments a
      configuration option, for the people who want to minimize the size of
      the kernel.
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: Richard Weinberger <richard@nod.at>
      Link: http://lkml.kernel.org/r/1398816946-3351-1-git-send-email-hpa@linux.intel.com
      
      (cherry picked from commit 197725de)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      8461e05f
    • Sven Wegener's avatar
      x86_32, entry: Store badsys error code in %eax · b47af4d9
      Sven Wegener authored
      Commit 554086d8 ("x86_32, entry: Do syscall exit work on badsys
      (CVE-2014-4508)") introduced a regression in the x86_32 syscall entry
      code, resulting in syscall() not returning proper errors for undefined
      syscalls on CPUs supporting the sysenter feature.
      
      The following code:
      
      > int result = syscall(666);
      > printf("result=%d errno=%d error=%s\n", result, errno, strerror(errno));
      
      results in:
      
      > result=666 errno=0 error=Success
      
      Obviously, the syscall return value is the called syscall number, but it
      should have been an ENOSYS error. When run under ptrace it behaves
      correctly, which makes it hard to debug in the wild:
      
      > result=-1 errno=38 error=Function not implemented
      
      The %eax register is the return value register. For debugging via ptrace
      the syscall entry code stores the complete register context on the
      stack. The badsys handlers only store the ENOSYS error code in the
      ptrace register set and do not set %eax like a regular syscall handler
      would. The old resume_userspace call chain contains code that clobbers
      %eax and it restores %eax from the ptrace registers afterwards. The same
      goes for the ptrace-enabled call chain. When ptrace is not used, the
      syscall return value is the passed-in syscall number from the untouched
      %eax register.
      
      Use %eax as the return value register in syscall_badsys and
      sysenter_badsys, like a real syscall handler does, and have the caller
      push the value onto the stack for ptrace access.
      Signed-off-by: default avatarSven Wegener <sven.wegener@stealer.net>
      Link: http://lkml.kernel.org/r/alpine.LNX.2.11.1407221022380.31021@titan.int.lan.stealer.netReviewed-and-tested-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: <stable@vger.kernel.org> # If 554086d8 is backported
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      
      (cherry picked from commit 8142b215)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      b47af4d9
    • Takashi Iwai's avatar
      PM / sleep: Fix request_firmware() error at resume · 13bfcd58
      Takashi Iwai authored
      The commit [247bc037: PM / Sleep: Mitigate race between the freezer
      and request_firmware()] introduced the finer state control, but it
      also leads to a new bug; for example, a bug report regarding the
      firmware loading of intel BT device at suspend/resume:
        https://bugzilla.novell.com/show_bug.cgi?id=873790
      
      The root cause seems to be a small window between the process resume
      and the clear of usermodehelper lock.  The request_firmware() function
      checks the UMH lock and gives up when it's in UMH_DISABLE state.  This
      is for avoiding the invalid  f/w loading during suspend/resume phase.
      The problem is, however, that usermodehelper_enable() is called at the
      end of thaw_processes().  Thus, a thawed process in between can kick
      off the f/w loader code path (in this case, via btusb_setup_intel())
      even before the call of usermodehelper_enable().  Then
      usermodehelper_read_trylock() returns an error and request_firmware()
      spews WARN_ON() in the end.
      
      This oneliner patch fixes the issue just by setting to UMH_FREEZING
      state again before restarting tasks, so that the call of
      request_firmware() will be blocked until the end of this function
      instead of returning an error.
      
      Fixes: 247bc037 (PM / Sleep: Mitigate race between the freezer and request_firmware())
      Link: https://bugzilla.novell.com/show_bug.cgi?id=873790
      Cc: 3.4+ <stable@vger.kernel.org> # 3.4+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      
      (cherry picked from commit 4320f6b1)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      13bfcd58
    • John Stultz's avatar
      alarmtimer: Fix bug where relative alarm timers were treated as absolute · 4864494f
      John Stultz authored
      Sharvil noticed with the posix timer_settime interface, using the
      CLOCK_REALTIME_ALARM or CLOCK_BOOTTIME_ALARM clockid, if the users
      tried to specify a relative time timer, it would incorrectly be
      treated as absolute regardless of the state of the flags argument.
      
      This patch corrects this, properly checking the absolute/relative flag,
      as well as adds further error checking that no invalid flag bits are set.
      Reported-by: default avatarSharvil Nanavati <sharvil@google.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Sharvil Nanavati <sharvil@google.com>
      Cc: stable <stable@vger.kernel.org> #3.0+
      Link: http://lkml.kernel.org/r/1404767171-6902-1-git-send-email-john.stultz@linaro.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      
      (cherry picked from commit 16927776)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      4864494f
    • Alex Deucher's avatar
      drm/radeon: avoid leaking edid data · d76fa2c7
      Alex Deucher authored
      In some cases we fetch the edid in the detect() callback
      in order to determine what sort of monitor is connected.
      If that happens, don't fetch the edid again in the get_modes()
      callback or we will leak the edid.
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      
      (cherry picked from commit 0ac66eff)
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      d76fa2c7