1. 08 Nov, 2013 7 commits
    • Erez Shitrit's avatar
      IPoIB: Start multicast join process only on active ports · 94232d9c
      Erez Shitrit authored
      The driver starts the mcast_join task whenever the netdev interface is
      UP without relation to the underlying IB port state.
      
      Until the port state is ACTIVE all the join requests are irrelevant,
      and the IB core returns -EINVAL. So the user will see errors such as:
      "multicast join failed for ff12:401b:... , status -22".
      
      Instead, have ipoib_mcast_join_task() return when the port is not active.
      
      It will be called again when the port state is changed and the
      low-level driver triggers the IB_EVENT_PORT_ACTIVE event or the
      IB_EVENT_CLIENT_REREGISTER event.
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      94232d9c
    • Erez Shitrit's avatar
      IPoIB: Add path query flushing in ipoib_ib_dev_cleanup · a39c52ab
      Erez Shitrit authored
      The path_rec_completion() callback may be invoked asynchronously even
      at the middle of "driver uninit" process.  This can lead to scheduling
      a task that tries to touch members of the priv object that are no
      longer valid.  For example the function cm_create_tx_qp can attempt to
      create qp with no valid priv->pd object.
      
      The following crash is one of the results:
      RIP: 0010:[<ffffffffa021bb47>]  [<ffffffffa021bb47>] ipoib_cm_create_tx_qp+0x57/0x90 [ib_ipoib]
      Process ipoib (pid: 5916, threadinfo ffff8803786e4000, task ffff8804150e1500)
      Stack:
      Call Trace:
      [<ffffffff81309ef0>] ? get_random_bytes+0x20/0x30
      [<ffffffffa021be2a>] ipoib_cm_tx_init+0xca/0x340 [ib_ipoib]
      [<ffffffffa021f765>] ipoib_cm_tx_start+0x215/0x3f0 [ib_ipoib]
      [<ffffffffa021f550>] ? ipoib_cm_tx_start+0x0/0x3f0 [ib_ipoib]
      [<ffffffff8108b2b0>] worker_thread+0x170/0x2a0
      [<ffffffff81090bf0>] ? autoremove_wake_function+0x0/0x40
      [<ffffffff8108b140>] ? worker_thread+0x0/0x2a0
      [<ffffffff81090886>] kthread+0x96/0xa0
      [<ffffffff8100c14a>] child_rip+0xa/0x20
      [<ffffffff810907f0>] ? kthread+0x0/0xa0
      [<ffffffff8100c140>] ? child_rip+0x0/0x20
      
      Fix that by flushing all pending path queries at this point.
      Signed-off-by: default avatarAlex Markuze <markuze@mellanox.com>
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      a39c52ab
    • Erez Shitrit's avatar
      IPoIB: Fix usage of uninitialized multicast objects · a9c8ba58
      Erez Shitrit authored
      The driver should avoid calling ib_sa_free_multicast on the mcast->mc
      object until it finishes its initialization state.  Otherwise we can
      crash when ipoib_mcast_dev_flush() attempts to use the uninitialized
      multicast object.
      
      Instead, only call wait_for_completion() for multicast entries that
      started the join process, meaning that ib_sa_join_multicast() finished.
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      a9c8ba58
    • Erez Shitrit's avatar
      IPoIB: Avoid flushing the driver workqueue on dev_down · aede2501
      Erez Shitrit authored
      The driver should not flush the whole workqueue when only one work (the
      pkey poll one) needs to be cancelled.  Use cancel_delayed_work_sync()
      instead.
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      aede2501
    • Erez Shitrit's avatar
      IPoIB: Fix deadlock between dev_change_flags() and __ipoib_dev_flush() · f47944cc
      Erez Shitrit authored
      When ipoib interface is going down it takes all of its children with
      it, under mutex.
      
      For each child, dev_change_flags() is called.  That function calls
      ipoib_stop() via the ndo, and causes flush of the workqueue.
      Sometimes in the workqueue an __ipoib_dev_flush work() is waiting and
      when invoked tries to get the same mutex, which leads to a deadlock,
      as seen below.
      
      The solution is to switch to rw-sem instead of mutex.
      
      The deadlock:
      [11028.165303]  [<ffffffff812b0977>] ? vgacon_scroll+0x107/0x2e0
      [11028.171844]  [<ffffffff814eaac5>] schedule_timeout+0x215/0x2e0
      [11028.178465]  [<ffffffff8105a5c3>] ? perf_event_task_sched_out+0x33/0x80
      [11028.185962]  [<ffffffff814ea743>] wait_for_common+0x123/0x180
      [11028.192491]  [<ffffffff8105fa40>] ? default_wake_function+0x0/0x20
      [11028.199504]  [<ffffffff814ea85d>] wait_for_completion+0x1d/0x20
      [11028.206224]  [<ffffffff8108b4f1>] flush_cpu_workqueue+0x61/0x90
      [11028.212948]  [<ffffffff8108b5a0>] ? wq_barrier_func+0x0/0x20
      [11028.219375]  [<ffffffff8108bfc4>] flush_workqueue+0x54/0x80
      [11028.225712]  [<ffffffffa05a0576>] ipoib_mcast_stop_thread+0x66/0x90 [ib_ipoib]
      [11028.233988]  [<ffffffffa059ccea>] ipoib_ib_dev_down+0x6a/0x100 [ib_ipoib]
      [11028.241678]  [<ffffffffa059849a>] ipoib_stop+0x8a/0x140 [ib_ipoib]
      [11028.248692]  [<ffffffff8142adf1>] dev_close+0x71/0xc0
      [11028.254447]  [<ffffffff8142a631>] dev_change_flags+0xa1/0x1d0
      [11028.261062]  [<ffffffffa059851b>] ipoib_stop+0x10b/0x140 [ib_ipoib]
      [11028.268172]  [<ffffffff8142adf1>] dev_close+0x71/0xc0
      [11028.273922]  [<ffffffff8142a631>] dev_change_flags+0xa1/0x1d0
      [11028.280452]  [<ffffffff8148f20b>] devinet_ioctl+0x5eb/0x6a0
      [11028.286786]  [<ffffffff814903b8>] inet_ioctl+0x88/0xa0
      [11028.292633]  [<ffffffff8141591a>] sock_ioctl+0x7a/0x280
      [11028.298576]  [<ffffffff81189012>] vfs_ioctl+0x22/0xa0
      [11028.304326]  [<ffffffff81140540>] ? unmap_region+0x110/0x130
      [11028.310756]  [<ffffffff811891b4>] do_vfs_ioctl+0x84/0x580
      [11028.316897]  [<ffffffff81189731>] sys_ioctl+0x81/0xa0
      
      and
      
      11028.017533]  [<ffffffff8105a5c3>] ? perf_event_task_sched_out+0x33/0x80
      [11028.025030]  [<ffffffff8100bb8e>] ? apic_timer_interrupt+0xe/0x20
      [11028.031945]  [<ffffffff814eb2ae>] __mutex_lock_slowpath+0x13e/0x180
      [11028.039053]  [<ffffffff814eb14b>] mutex_lock+0x2b/0x50
      [11028.044910]  [<ffffffffa059f7e7>] __ipoib_ib_dev_flush+0x37/0x210 [ib_ipoib]
      [11028.052894]  [<ffffffffa059fa00>] ? ipoib_ib_dev_flush_light+0x0/0x20 [ib_ipoib]
      [11028.061363]  [<ffffffffa059fa17>] ipoib_ib_dev_flush_light+0x17/0x20 [ib_ipoib]
      [11028.069738]  [<ffffffff8108b120>] worker_thread+0x170/0x2a0
      [11028.076068]  [<ffffffff81090990>] ? autoremove_wake_function+0x0/0x40
      [11028.083374]  [<ffffffff8108afb0>] ? worker_thread+0x0/0x2a0
      [11028.089709]  [<ffffffff81090626>] kthread+0x96/0xa0
      [11028.095266]  [<ffffffff8100c0ca>] child_rip+0xa/0x20
      [11028.100921]  [<ffffffff81090590>] ? kthread+0x0/0xa0
      [11028.106573]  [<ffffffff8100c0c0>] ? child_rip+0x0/0x20
      [11028.112423] INFO: task ifconfig:23640 blocked for more than 120 seconds.
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      f47944cc
    • Tal Alon's avatar
      IPoIB: Change CM skb memory allocation to be non-atomic during init · 22252b4e
      Tal Alon authored
      Change CM skb memory allocation to use GFP_KERNEL when possible.
      
      During device init there's no need to use GFP_ATOMIC when allocating
      memory for the CM skbs -- use GFP_KERNEL instead.
      Signed-off-by: default avatarTal Alon <talal@mellanox.com>
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      22252b4e
    • Erez Shitrit's avatar
      IPoIB: Fix crash in dev_open error flow · c2bb5628
      Erez Shitrit authored
      If napi has never been enabled when calling ipoib_ib_dev_stop, a
      kernel crash occurs, because the verbs layer completion handler
      (ipoib_ib_completion) calls napi_schedule unconditionally.
      
      If the napi structure passed in the napi_schedule call has not
      been initialized, napi will crash.
      
      The cleanest solution is to simply enable napi before calling
      ipoib_ib_dev_stop in the dev_open error flow. (dev_stop then
      immediately disables napi).
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarErez Shitrit <erezsh@mellanox.com>
      Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      c2bb5628
  2. 27 Oct, 2013 8 commits
    • Linus Torvalds's avatar
      Linux 3.12-rc7 · 959f5854
      Linus Torvalds authored
      959f5854
    • Linus Torvalds's avatar
      Merge branch 'parisc-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · a2ff8206
      Linus Torvalds authored
      Pull parisc fix from Helge Deller:
       "This is a 2-line patch to save the CPU register which holds our task
        thread info pointer before calling a firmware function and then to
        restore it again afterwards.
      
        This is necessary because on some 64bit machines the high-order 32bits
        are being clobbered by the firmware call, and thus we failed to bring
        up secondary CPUs (and instead crashed the kernel) in some situations
        eg if we had more than 4GB RAM.  This patch fixes a bug which has been
        since ever in the parisc linux kernel and which prevented some people
        to use a 64bit kernel"
      
      * 'parisc-3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Do not crash 64bit SMP kernels on machines with >= 4GB RAM
      a2ff8206
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · aff22d3f
      Linus Torvalds authored
      Pull timer fix from Ingo Molnar:
       "This tree contains a clockevents regression fix for certain ARM
        subarchitectures"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clockevents: Sanitize ticks to nsec conversion
      aff22d3f
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e2756f5e
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "The tree contains three fixes:
      
         - Two tooling fixes
      
         - Reversal of the new 'MMAP2' extended mmap record ABI, introduced in
           this merge window.  (Patches were proposed to fix it but it was all
           a bit late and we felt it's safer to just delay the ABI one more
           kernel release and do it right)"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf: Disable PERF_RECORD_MMAP2 support
        perf scripting perl: Fix build error on Fedora 12
        perf probe: Fix to initialize fname always before use it
      e2756f5e
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1c99ca43
      Linus Torvalds authored
      Pull locking fix from Ingo Molnar:
       "This tree fixes a boot crash in CONFIG_DEBUG_MUTEXES=y kernels, on
        kernels built with GCC 3.x (there are still such distros)"
      
      Side note: it's not just a fix for old gcc versions, it's also removing
      an incredibly broken/subtle check that LLVM had issues with, and that
      made no sense.
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        mutex: Avoid gcc version dependent __builtin_constant_p() usage
      1c99ca43
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · acda24c4
      Linus Torvalds authored
      Pull SCSI target fixes from Nicholas Bellinger:
       "Here are the outstanding target pending fixes for v3.12-rc7.
      
        This includes a number of EXTENDED_COPY related fixes as a result of
        Thomas and Doug's continuing testing and feedback.
      
        Also included is an important vhost/scsi fix that addresses a long
        standing issue where the 'write' parameter for get_user_pages_fast()
        was incorrectly set for virtio-scsi WRITEs -> DMA_TO_DEVICE, and not
        for virtio-scsi READs -> DMA_FROM_DEVICE.
      
        This resulted in random userspace segfaults and other unpleasantness
        on KVM host, and unfortunately has been an issue since the initial
        merge of vhost/scsi in v3.6.  This patch is CC'ed to stable, along
        with two other less critical items"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
        vhost/scsi: Fix incorrect usage of get_user_pages_fast write parameter
        target/pscsi: fix return value check
        target: Fail XCOPY for non matching source + destination block_size
        target: Generate failure for XCOPY I/O with non-zero scsi_status
        target: Add missing XCOPY I/O operation sense_buffer
        iser-target: check device before dereferencing its variable
        target: Return an error for WRITE SAME with ANCHOR==1
        target: Fix assignment of LUN in tracepoints
        target: Reject EXTENDED_COPY when emulate_3pc is disabled
        target: Allow non zero ListID in EXTENDED_COPY parameter list
        target: Make target_do_xcopy failures return INVALID_PARAMETER_LIST
      acda24c4
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma · 63e65608
      Linus Torvalds authored
      Pull slave-dmaengine fixes from Vinod Koul:
       "Here is the late fixes pull request for dmaengine while you fly back
        from KS.
      
        We have a new dmaengine ML hosted by vger so a patch for that along
        with addition of Dave as driver mainatainer for ioat.  Other fixes are
        memeory leak fixes on edma driver, small fixes on rcar-hpbdma driver
        by Sergei"
      
      * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma:
        dmaengine: edma: fix another memory leak
        dma: edma: Fix memory leak
        MAINTAINERS: add to ioatdma maintainer list
        MAINTAINERS: add the new dmaengine mailing list
      63e65608
    • Helge Deller's avatar
      parisc: Do not crash 64bit SMP kernels on machines with >= 4GB RAM · 54e181e0
      Helge Deller authored
      Since the beginning of the parisc-linux port, sometimes 64bit SMP kernels were
      not able to bring up other CPUs than the monarch CPU and instead crashed the
      kernel.  The reason was unclear, esp. since it involved various machines (e.g.
      J5600, J6750 and SuperDome). Testing showed, that those crashes didn't happened
      when less than 4GB were installed, or if a 32bit Linux kernel was booted.
      
      In the end, the fix for those SMP problems is trivial:
      During the early phase of the initialization of the CPUs, including the monarch
      CPU, the PDC_PSW firmware function to enable WIDE (=64bit) mode is called.
      It's documented that this firmware function may clobber various registers, and
      one one of those possibly clobbered registers is %cr30 which holds the task
      thread info pointer.
      
      Now, if %cr30 would always have been clobbered, then this bug would have been
      detected much earlier. But lots of testing finally showed, that - at least for
      %cr30 - on some machines only the upper 32bits of the 64bit register suddenly
      turned zero after the firmware call.
      
      So, after finding the root cause, the explanation for the various crashes
      became clear:
      - On 32bit SMP Linux kernels all upper 32bit were zero, so we didn't faced this
        problem.
      - Monarch CPUs in 64bit mode always booted sucessfully, because the inital task
        thread info pointer was below 4GB.
      - Secondary CPUs booted sucessfully on machines with less than 4GB RAM because
        the upper 32bit were zero anyay.
      - Secondary CPus failed to boot if we had more than 4GB RAM and the task thread
        info pointer was located above the 4GB boundary.
      
      Finally, the patch to fix this problem is trivial by saving the %cr30 register
      before the firmware call and restoring it afterwards.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: <stable@vger.kernel.org> # 2.6.12+
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      54e181e0
  3. 26 Oct, 2013 1 commit
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-3.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 20582e34
      Linus Torvalds authored
      Pull ACPI and power management fixes from
       "These fix two bugs in the intel_pstate driver, a hibernate bug leading
        to nasty resume failures sometimes and acpi-cpufreq initialization bug
        that causes problems to happen during module unload when intel_pstate
        is in use.
      
        Specifics:
      
         - Fix for rounding errors in intel_pstate causing CPU utilization to
           be underestimated from Brennan Shacklett.
      
         - intel_pstate fix to always use the correct max pstate value when
           computing the min pstate from Dirk Brandewie.
      
         - Hibernation fix for deadlocking resume in cases when the probing of
           the device containing the image is deferred from Russ Dill.
      
         - acpi-cpufreq fix to prevent the module from staying in memory when
           the driver cannot be registered and then attempting to unregister
           things that have never been registered on exit"
      
      * tag 'pm+acpi-3.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        acpi-cpufreq: Fail initialization if driver cannot be registered
        PM / hibernate: Move software_resume to late_initcall_sync
        intel_pstate: Correct calculation of min pstate value
        intel_pstate: Improve accuracy by not truncating until final result
      20582e34
  4. 25 Oct, 2013 9 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20131025' of git://git.infradead.org/linux-mtd · d255c59a
      Linus Torvalds authored
      Pull final mtd fixes from Brian Norris:
       "A few more last-minute regression fixes, prepared jointly by me and
        David Woodhouse:
      
         - Revert pxa3xx to its old name to avoid breaking existing
           'mtdparts=' boot strings.
      
         - Return GPMI NAND to its legacy ECC layout for backwards
           compatibility.  We will revisit this in 3.13.
      
        A note from David on the latter fix: 'This leaves a harmless cosmetic
        warning about an unused function.  At this point in the cycle I really
        don't care.'"
      
      * tag 'for-linus-20131025' of git://git.infradead.org/linux-mtd:
        mtd: gpmi: fix ECC regression
        mtd: nand: pxa3xx: Fix registered MTD name
      d255c59a
    • Nicholas Bellinger's avatar
      vhost/scsi: Fix incorrect usage of get_user_pages_fast write parameter · 60a01f55
      Nicholas Bellinger authored
      This patch addresses a long-standing bug where the get_user_pages_fast()
      write parameter used for setting the underlying page table entry permission
      bits was incorrectly set to write=1 for data_direction=DMA_TO_DEVICE, and
      passed into get_user_pages_fast() via vhost_scsi_map_iov_to_sgl().
      
      However, this parameter is intended to signal WRITEs to pinned userspace
      PTEs for the virtio-scsi DMA_FROM_DEVICE -> READ payload case, and *not*
      for the virtio-scsi DMA_TO_DEVICE -> WRITE payload case.
      
      This bug would manifest itself as random process segmentation faults on
      KVM host after repeated vhost starts + stops and/or with lots of vhost
      endpoints + LUNs.
      
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Asias He <asias@redhat.com>
      Cc: <stable@vger.kernel.org> # 3.6+
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      60a01f55
    • Wei Yongjun's avatar
      target/pscsi: fix return value check · 58932e96
      Wei Yongjun authored
      In case of error, the function scsi_host_lookup() returns NULL
      pointer not ERR_PTR(). The IS_ERR() test in the return value check
      should be replaced with NULL test.
      Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      58932e96
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · f55ac56d
      Linus Torvalds authored
      Pull vfs fixes (try two) from Al Viro:
       "nfsd performance regression fix + seq_file lseek(2) fix"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        seq_file: always update file->f_pos in seq_lseek()
        nfsd regression since delayed fput()
      f55ac56d
    • David Woodhouse's avatar
      mtd: gpmi: fix ECC regression · 031e2777
      David Woodhouse authored
      The "legacy" ECC layout used until 3.12-rc1 uses all the OOB area by
      computing the ECC strength and ECC step size ourselves.
      
      Commit 2febcdf8 ("mtd: gpmi: set the BCHs geometry with the ecc info")
      makes the driver use the ECC info (ECC strength and ECC step size)
      provided by the MTD code, and creates a different NAND ECC layout
      for the BCH, and use the new ECC layout. This causes a regression:
      
         We can not mount the ubifs which was created by the old NAND ECC layout.
      
      This patch fixes this issue by reverting to the legacy ECC layout.
      
      We will probably introduce a new device-tree property to indicate that
      the new ECC layout can be used. For now though, for the imminent 3.12
      release, we just unconditionally revert to the 3.11 behaviour.
      
      This leaves a harmless cosmetic warning about an unused function. At
      this point in the cycle I really don't care.
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Acked-by: default avatarHuang Shijie <b32955@freescale.com>
      Acked-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarMarek Vasut <marex@denx.de>
      031e2777
    • Gu Zheng's avatar
      seq_file: always update file->f_pos in seq_lseek() · 05e16745
      Gu Zheng authored
      This issue was first pointed out by Jiaxing Wang several months ago, but no
      further comments:
      https://lkml.org/lkml/2013/6/29/41
      
      As we know pread() does not change f_pos, so after pread(), file->f_pos
      and m->read_pos become different. And seq_lseek() does not update file->f_pos
      if offset equals to m->read_pos, so after pread() and seq_lseek()(lseek to
      m->read_pos), then a subsequent read may read from a wrong position, the
      following program produces the problem:
      
          char str1[32] = { 0 };
          char str2[32] = { 0 };
          int poffset = 10;
          int count = 20;
      
          /*open any seq file*/
          int fd = open("/proc/modules", O_RDONLY);
      
          pread(fd, str1, count, poffset);
          printf("pread:%s\n", str1);
      
          /*seek to where m->read_pos is*/
          lseek(fd, poffset+count, SEEK_SET);
      
          /*supposed to read from poffset+count, but this read from position 0*/
          read(fd, str2, count);
          printf("read:%s\n", str2);
      
      out put:
      pread:
       ck_netbios_ns 12665
      read:
       nf_conntrack_netbios
      
      /proc/modules:
      nf_conntrack_netbios_ns 12665 0 - Live 0xffffffffa038b000
      nf_conntrack_broadcast 12589 1 nf_conntrack_netbios_ns, Live 0xffffffffa0386000
      
      So we always update file->f_pos to offset in seq_lseek() to fix this issue.
      Signed-off-by: default avatarJiaxing Wang <hello.wjx@gmail.com>
      Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      05e16745
    • Rafael J. Wysocki's avatar
      acpi-cpufreq: Fail initialization if driver cannot be registered · 75c07581
      Rafael J. Wysocki authored
      Make acpi_cpufreq_init() return error codes when the driver cannot be
      registered so that the module doesn't stay useless in memory and so
      that acpi_cpufreq_exit() doesn't attempt to unregister things that
      have never been registered when the module is unloaded.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      75c07581
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 4208c471
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "There's really only one bugfix in this branch, which is a fix for
        timers on the integrator platform.  Since Linus Walleij is
        resurrecting support for the platform it seems valuable to get the fix
        into 3.12 even though the regression has been around a while.
      
        The rest are a handful of maintainers updates.  If you prefer to hold
        those until 3.13 then just merge the first patch on the branch which
        is the fix"
      
      * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        MAINTAINERS: Add maintainers entry for Rockchip SoCs
        MAINTAINERS: Tegra updates, and driver ownership
        MAINTAINERS: ARM: mvebu: add Sebastian Hesselbarth
        ARM: integrator: deactivate timer0 on the Integrator/CP
      4208c471
    • Linus Torvalds's avatar
      Merge tag 'ecryptfs-3.12-rc7-fixes' of... · 88829dfe
      Linus Torvalds authored
      Merge tag 'ecryptfs-3.12-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
      
      Pull ecryptfs fixes from Tyler Hicks:
       "Two important fixes
         - Fix long standing memory leak in the (rarely used) public key
           support
         - Fix large file corruption on 32 bit architectures"
      
      * tag 'ecryptfs-3.12-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
        eCryptfs: fix 32 bit corruption issue
        ecryptfs: Fix memory leakage in keystore.c
      88829dfe
  5. 24 Oct, 2013 15 commits
    • Russ Dill's avatar
      PM / hibernate: Move software_resume to late_initcall_sync · d3c345db
      Russ Dill authored
      software_resume is being called after deferred_probe_initcall in
      drivers base. If the probing of the device that contains the resume
      image is deferred, and the system has been instructed to wait for
      it to show up, this wait will occur in software_resume. This causes
      a deadlock.
      
      Move software_resume into late_initcall_sync so that it happens
      after all the other late_initcalls.
      Signed-off-by: default avatarRuss Dill <Russ.Dill@ti.com>
      Acked-by: default avatarPavel Machek <Pavel@ucw.cz>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d3c345db
    • Ezequiel Garcia's avatar
      mtd: nand: pxa3xx: Fix registered MTD name · 18a84e93
      Ezequiel Garcia authored
      In a recent commit:
      
        commit f455578d
        Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
        Date:   Mon Aug 12 14:14:53 2013 -0300
      
        mtd: nand: pxa3xx: Remove hardcoded mtd name
      
        There's no advantage in using a hardcoded name for the mtd device.
        Instead use the provided by the platform_device.
      
      The MTD name was changed to use the one provided by the platform_device.
      However, this can be problematic as some users want to set partitions
      using the kernel parameter 'mtdparts', where the name is needed.
      
      Therefore, to avoid regressions in users relying in 'mtdparts' we revert
      the change and use the previous one 'pxa3xx_nand-0'.
      
      While at it, let's put a big comment and prevent this change from happening
      ever again.
      Signed-off-by: default avatarEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      18a84e93
    • Colin Ian King's avatar
      eCryptfs: fix 32 bit corruption issue · 43b7c6c6
      Colin Ian King authored
      Shifting page->index on 32 bit systems was overflowing, causing
      data corruption of > 4GB files. Fix this by casting it first.
      
      https://launchpad.net/bugs/1243636Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Reported-by: default avatarLars Duesing <lars.duesing@camelotsweb.de>
      Cc: stable@vger.kernel.org # v3.11+
      Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
      43b7c6c6
    • Vinod Koul's avatar
      dmaengine: edma: fix another memory leak · 72618287
      Vinod Koul authored
      commit 4b6271a6 fix a menory leak but one more existed in driver so fix that
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      72618287
    • Valentin Ilie's avatar
      dma: edma: Fix memory leak · 4b6271a6
      Valentin Ilie authored
      When it fails to allocate a slot, edesc should be free'd before return;
      Signed-off-by: default avatarValentin Ilie <valentin.ilie@gmail.com>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      4b6271a6
    • Nicholas Bellinger's avatar
      target: Fail XCOPY for non matching source + destination block_size · 48502ddb
      Nicholas Bellinger authored
      This patch adds an explicit check + failure for XCOPY I/O to source +
      destination devices with a non-matching block_size.
      
      This limitiation is currently due to the fact that the scatterlist
      memory allocated for the XCOPY READ operation is passed zero-copy
      to the XCOPY WRITE operation.
      Reported-by: default avatarThomas Glanzmann <thomas@glanzmann.de>
      Reported-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Cc: Thomas Glanzmann <thomas@glanzmann.de>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      48502ddb
    • Nicholas Bellinger's avatar
      target: Generate failure for XCOPY I/O with non-zero scsi_status · 8a955d6d
      Nicholas Bellinger authored
      This patch adds the missing non-zero se_cmd->scsi_status check required
      for local XCOPY I/O within target_xcopy_issue_pt_cmd() to signal an
      exception case failure.
      
      This will trigger the generation of SAM_STAT_CHECK_CONDITION status
      from within target_xcopy_do_work() process context code.
      Reported-by: default avatarThomas Glanzmann <thomas@glanzmann.de>
      Reported-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Cc: Thomas Glanzmann <thomas@glanzmann.de>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      8a955d6d
    • Nicholas Bellinger's avatar
      target: Add missing XCOPY I/O operation sense_buffer · 366bda19
      Nicholas Bellinger authored
      This patch adds the missing xcopy_pt_cmd->sense_buffer[] required for
      correctly handling CHECK_CONDITION exceptions within the locally
      generated XCOPY I/O path.
      
      Also update target_xcopy_read_source() + target_xcopy_setup_pt_cmd()
      to pass this buffer into transport_init_se_cmd() to correctly setup
      se_cmd->sense_buffer.
      Reported-by: default avatarThomas Glanzmann <thomas@glanzmann.de>
      Reported-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Cc: Thomas Glanzmann <thomas@glanzmann.de>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      366bda19
    • Linus Torvalds's avatar
      Merge tag 'md/3.12-fixes' of git://neil.brown.name/md · e6036c0b
      Linus Torvalds authored
      Pull md bugfixes from Neil Brown:
       "Assorted md bug-fixes for 3.12.
      
        All tagged for -stable releases too"
      
      * tag 'md/3.12-fixes' of git://neil.brown.name/md:
        raid5: avoid finding "discard" stripe
        raid5: set bio bi_vcnt 0 for discard request
        md: avoid deadlock when md_set_badblocks.
        md: Fix skipping recovery for read-only arrays.
      e6036c0b
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · be6e8c76
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a set of two fixes which cause oopses (Buslogic, qla2xxx) and
       one fix which may cause a hang because of request miscounting (sd)"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        [SCSI] sd: call blk_pm_runtime_init before add_disk
        [SCSI] qla2xxx: Fix request queue null dereference.
        [SCSI] BusLogic: Fix an oops when intializing multimaster adapter
      be6e8c76
    • Vu Pham's avatar
      iser-target: check device before dereferencing its variable · 0a66614b
      Vu Pham authored
      This patch changes isert_connect_release() to correctly check for
      the existence struct isert_device *device before checking for
      isert_device->use_frwr.
      Signed-off-by: default avatarVu Pham <vu@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      0a66614b
    • Shaohua Li's avatar
      raid5: avoid finding "discard" stripe · d47648fc
      Shaohua Li authored
      SCSI discard will damage discard stripe bio setting, eg, some fields are
      changed. If the stripe is reused very soon, we have wrong bios setting. We
      remove discard stripe from hash list, so next time the strip will be fully
      initialized.
      
      Suitable for backport to 3.7+.
      
      Cc: <stable@vger.kernel.org> (3.7+)
      Signed-off-by: default avatarShaohua Li <shli@fusionio.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      d47648fc
    • Shaohua Li's avatar
      raid5: set bio bi_vcnt 0 for discard request · 37c61ff3
      Shaohua Li authored
      SCSI layer will add new payload for discard request. If two bios are merged
      to one, the second bio has bi_vcnt 1 which is set in raid5. This will confuse
      SCSI and cause oops.
      
      Suitable for backport to 3.7+
      
      Cc: stable@vger.kernel.org (v3.7+)
      Reported-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
      Signed-off-by: default avatarShaohua Li <shli@fusionio.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      37c61ff3
    • Bian Yu's avatar
      md: avoid deadlock when md_set_badblocks. · 905b0297
      Bian Yu authored
      When operate harddisk and hit errors, md_set_badblocks is called after
      scsi_restart_operations which already disabled the irq. but md_set_badblocks
      will call write_sequnlock_irq and enable irq. so softirq can preempt the
      current thread and that may cause a deadlock. I think this situation should
      use write_sequnlock_irqsave/irqrestore instead.
      
      I met the situation and the call trace is below:
      [  638.919974] BUG: spinlock recursion on CPU#0, scsi_eh_13/1010
      [  638.921923]  lock: 0xffff8800d4d51fc8, .magic: dead4ead, .owner: scsi_eh_13/1010, .owner_cpu: 0
      [  638.923890] CPU: 0 PID: 1010 Comm: scsi_eh_13 Not tainted 3.12.0-rc5+ #37
      [  638.925844] Hardware name: To be filled by O.E.M. To be filled by O.E.M./MAHOBAY, BIOS 4.6.5 03/05/2013
      [  638.927816]  ffff880037ad4640 ffff880118c03d50 ffffffff8172ff85 0000000000000007
      [  638.929829]  ffff8800d4d51fc8 ffff880118c03d70 ffffffff81730030 ffff8800d4d51fc8
      [  638.931848]  ffffffff81a72eb0 ffff880118c03d90 ffffffff81730056 ffff8800d4d51fc8
      [  638.933884] Call Trace:
      [  638.935867]  <IRQ>  [<ffffffff8172ff85>] dump_stack+0x55/0x76
      [  638.937878]  [<ffffffff81730030>] spin_dump+0x8a/0x8f
      [  638.939861]  [<ffffffff81730056>] spin_bug+0x21/0x26
      [  638.941836]  [<ffffffff81336de4>] do_raw_spin_lock+0xa4/0xc0
      [  638.943801]  [<ffffffff8173f036>] _raw_spin_lock+0x66/0x80
      [  638.945747]  [<ffffffff814a73ed>] ? scsi_device_unbusy+0x9d/0xd0
      [  638.947672]  [<ffffffff8173fb1b>] ? _raw_spin_unlock+0x2b/0x50
      [  638.949595]  [<ffffffff814a73ed>] scsi_device_unbusy+0x9d/0xd0
      [  638.951504]  [<ffffffff8149ec47>] scsi_finish_command+0x37/0xe0
      [  638.953388]  [<ffffffff814a75e8>] scsi_softirq_done+0xa8/0x140
      [  638.955248]  [<ffffffff8130e32b>] blk_done_softirq+0x7b/0x90
      [  638.957116]  [<ffffffff8104fddd>] __do_softirq+0xfd/0x330
      [  638.958987]  [<ffffffff810b964f>] ? __lock_release+0x6f/0x100
      [  638.960861]  [<ffffffff8174a5cc>] call_softirq+0x1c/0x30
      [  638.962724]  [<ffffffff81004c7d>] do_softirq+0x8d/0xc0
      [  638.964565]  [<ffffffff8105024e>] irq_exit+0x10e/0x150
      [  638.966390]  [<ffffffff8174ad4a>] smp_apic_timer_interrupt+0x4a/0x60
      [  638.968223]  [<ffffffff817499af>] apic_timer_interrupt+0x6f/0x80
      [  638.970079]  <EOI>  [<ffffffff810b964f>] ? __lock_release+0x6f/0x100
      [  638.971899]  [<ffffffff8173fa6a>] ? _raw_spin_unlock_irq+0x3a/0x50
      [  638.973691]  [<ffffffff8173fa60>] ? _raw_spin_unlock_irq+0x30/0x50
      [  638.975475]  [<ffffffff81562393>] md_set_badblocks+0x1f3/0x4a0
      [  638.977243]  [<ffffffff81566e07>] rdev_set_badblocks+0x27/0x80
      [  638.978988]  [<ffffffffa00d97bb>] raid5_end_read_request+0x36b/0x4e0 [raid456]
      [  638.980723]  [<ffffffff811b5a1d>] bio_endio+0x1d/0x40
      [  638.982463]  [<ffffffff81304ff3>] req_bio_endio.isra.65+0x83/0xa0
      [  638.984214]  [<ffffffff81306b9f>] blk_update_request+0x7f/0x350
      [  638.985967]  [<ffffffff81306ea1>] blk_update_bidi_request+0x31/0x90
      [  638.987710]  [<ffffffff813085e0>] __blk_end_bidi_request+0x20/0x50
      [  638.989439]  [<ffffffff8130862f>] __blk_end_request_all+0x1f/0x30
      [  638.991149]  [<ffffffff81308746>] blk_peek_request+0x106/0x250
      [  638.992861]  [<ffffffff814a62a9>] ? scsi_kill_request.isra.32+0xe9/0x130
      [  638.994561]  [<ffffffff814a633a>] scsi_request_fn+0x4a/0x3d0
      [  638.996251]  [<ffffffff813040a7>] __blk_run_queue+0x37/0x50
      [  638.997900]  [<ffffffff813045af>] blk_run_queue+0x2f/0x50
      [  638.999553]  [<ffffffff814a5750>] scsi_run_queue+0xe0/0x1c0
      [  639.001185]  [<ffffffff814a7721>] scsi_run_host_queues+0x21/0x40
      [  639.002798]  [<ffffffff814a2e87>] scsi_restart_operations+0x177/0x200
      [  639.004391]  [<ffffffff814a4fe9>] scsi_error_handler+0xc9/0xe0
      [  639.005996]  [<ffffffff814a4f20>] ? scsi_unjam_host+0xd0/0xd0
      [  639.007600]  [<ffffffff81072f6b>] kthread+0xdb/0xe0
      [  639.009205]  [<ffffffff81072e90>] ? flush_kthread_worker+0x170/0x170
      [  639.010821]  [<ffffffff81748cac>] ret_from_fork+0x7c/0xb0
      [  639.012437]  [<ffffffff81072e90>] ? flush_kthread_worker+0x170/0x170
      
      This bug was introduce in commit  2e8ac303
      (the first time rdev_set_badblock was call from interrupt context),
      so this patch is appropriate for 3.5 and subsequent kernels.
      
      Cc: <stable@vger.kernel.org> (3.5+)
      Signed-off-by: default avatarBian Yu <bianyu@kedacom.com>
      Reviewed-by: default avatarJianpeng Ma <majianpeng@gmail.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      905b0297
    • Lukasz Dorau's avatar
      md: Fix skipping recovery for read-only arrays. · 61e4947c
      Lukasz Dorau authored
      Since:
              commit 7ceb17e8
              md: Allow devices to be re-added to a read-only array.
      
      spares are activated on a read-only array. In case of raid1 and raid10
      personalities it causes that not-in-sync devices are marked in-sync
      without checking if recovery has been finished.
      
      If a read-only array is degraded and one of its devices is not in-sync
      (because the array has been only partially recovered) recovery will be skipped.
      
      This patch adds checking if recovery has been finished before marking a device
      in-sync for raid1 and raid10 personalities. In case of raid5 personality
      such condition is already present (at raid5.c:6029).
      
      Bug was introduced in 3.10 and causes data corruption.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPawel Baldysiak <pawel.baldysiak@intel.com>
      Signed-off-by: default avatarLukasz Dorau <lukasz.dorau@intel.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      61e4947c