Skip to content
  1. Jan 15, 2014
    • Linus Torvalds's avatar
      Merge branch 'akpm' (incoming from Andrew) · 2e67c562
      Linus Torvalds authored
      Merge patches from Andrew Morton:
       "Six fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        lib/percpu_counter.c: fix __percpu_counter_add()
        crash_dump: fix compilation error (on MIPS at least)
        mm: fix crash when using XFS on loopback
        MIPS: fix blast_icache32 on loongson2
        MIPS: fix case mismatch in local_r4k_flush_icache_range()
        nilfs2: fix segctor bug that causes file system corruption
      2e67c562
    • Linus Torvalds's avatar
      Merge tag 'md/3.13-fixes' of git://neil.brown.name/md · 1a60864f
      Linus Torvalds authored
      Pull late md fixes from Neil Brown:
       "Half a dozen md bug fixes.
      
        All of these fix real bugs the people have hit, and are tagged for
        -stable.  Sorry they are late ....  Christmas holidays and all that.
        Hopefully they can still squeak into 3.13"
      
      * tag 'md/3.13-fixes' of git://neil.brown.name/md:
        md: fix problem when adding device to read-only array with bitmap.
        md/raid10: fix bug when raid10 recovery fails to recover a block.
        md/raid5: fix a recently broken BUG_ON().
        md/raid1: fix request counting bug in new 'barrier' code.
        md/raid10: fix two bugs in handling of known-bad-blocks.
        md/raid5: Fix possible confusion when multiple write errors occur.
      1a60864f
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 145830df
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "One nouveau regression fix on older cards, i915 black screen fixes,
        and a revert for a strange G33 intel problem"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/nouveau: fix null ptr dereferences on some boards
        Revert "drm: copy mode type in drm_mode_connector_list_update()"
        drm/i915/bdw: make sure south port interrupts are enabled properly v2
        drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
        drm/i915: fix DDI PLLs HW state readout code
      145830df
    • Ming Lei's avatar
      lib/percpu_counter.c: fix __percpu_counter_add() · 74e72f89
      Ming Lei authored
      
      
      __percpu_counter_add() may be called in softirq/hardirq handler (such
      as, blk_mq_queue_exit() is typically called in hardirq/softirq handler),
      so we need to call this_cpu_add()(irq safe helper) to update percpu
      counter, otherwise counts may be lost.
      
      This fixes the problem that 'rmmod null_blk' hangs in blk_cleanup_queue()
      because of miscounting of request_queue->mq_usage_counter.
      
      This patch is the v1 of previous one of "lib/percpu_counter.c:
      disable local irq when updating percpu couter", and takes Andrew's
      approach which may be more efficient for ARCHs(x86, s390) that
      have optimized this_cpu_add().
      
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Shaohua Li <shli@fusionio.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Fan 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>
      74e72f89
    • Qais Yousef's avatar
      crash_dump: fix compilation error (on MIPS at least) · 5a610fcc
      Qais Yousef authored
        In file included from kernel/crash_dump.c:2:0:
        include/linux/crash_dump.h:22:27: error: unknown type name `pgprot_t'
      
      when CONFIG_CRASH_DUMP=y
      
      The error was traced back to commit 9cb21813
      
       ("vmcore: introduce
      remap_oldmem_pfn_range()")
      
      include <asm/pgtable.h> to get the missing definition
      
      Signed-off-by: default avatarQais Yousef <qais.yousef@imgtec.com>
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
      Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Cc: <stable@vger.kernel.org>	[3.12+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5a610fcc
    • Mikulas Patocka's avatar
      mm: fix crash when using XFS on loopback · 03e5ac2f
      Mikulas Patocka authored
      Commit 8456a648 ("slab: use struct page for slab management") causes
      a crash in the LVM2 testsuite on PA-RISC (the crashing test is
      fsadm.sh).  The testsuite doesn't crash on 3.12, crashes on 3.13-rc1 and
      later.
      
       Bad Address (null pointer deref?): Code=15 regs=000000413edd89a0 (Addr=000006202224647d)
       CPU: 3 PID: 24008 Comm: loop0 Not tainted 3.13.0-rc6 #5
       task: 00000001bf3c0048 ti: 000000413edd8000 task.ti: 000000413edd8000
      
            YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
       PSW: 00001000000001101111100100001110 Not tainted
       r00-03  000000ff0806f90e 00000000405c8de0 000000004013e6c0 000000413edd83f0
       r04-07  00000000405a95e0 0000000000000200 00000001414735f0 00000001bf349e40
       r08-11  0000000010fe3d10 0000000000000001 00000040829c7778 000000413efd9000
       r12-15  0000000000000000 000000004060d800 0000000010fe3000 0000000010fe3000
       r16-19  000000413edd82a0 00000041078ddbc0 0000000000000010 0000000000000001
       r20-23  0008f3d0d83a8000 0000000000000000 00000040829c7778 0000000000000080
       r24-27  00000001bf349e40 00000001bf349e40 202d66202224640d 00000000405a95e0
       r28-31  202d662022246465 000000413edd88f0 000000413edd89a0 0000000000000001
       sr00-03  000000000532c000 0000000000000000 0000000000000000 000000000532c000
       sr04-07  0000000000000000 0000000000000000 0000000000000000 0000000000000000
      
       IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401fe42c 00000000401fe430
        IIR: 539c0030    ISR: 00000000202d6000  IOR: 000006202224647d
        CPU:        3   CR30: 000000413edd8000 CR31: 0000000000000000
        ORIG_R28: 00000000405a95e0
        IAOQ[0]: vma_interval_tree_iter_first+0x14/0x48
        IAOQ[1]: vma_interval_tree_iter_first+0x18/0x48
        RP(r2): flush_dcache_page+0x128/0x388
       Backtrace:
         flush_dcache_page+0x128/0x388
         lo_splice_actor+0x90/0x148 [loop]
         splice_from_pipe_feed+0xc0/0x1d0
         __splice_from_pipe+0xac/0xc0
         lo_direct_splice_actor+0x1c/0x70 [loop]
         splice_direct_to_actor+0xec/0x228
         lo_receive+0xe4/0x298 [loop]
         loop_thread+0x478/0x640 [loop]
         kthread+0x134/0x168
         end_fault_vector+0x20/0x28
         xfs_setsize_buftarg+0x0/0x90 [xfs]
      
       Kernel panic - not syncing: Bad Address (null pointer deref?)
      
      Commit 8456a648
      
       changes the page structure so that the slab
      subsystem reuses the page->mapping field.
      
      The crash happens in the following way:
       * XFS allocates some memory from slab and issues a bio to read data
         into it.
       * the bio is sent to the loopback device.
       * lo_receive creates an actor and calls splice_direct_to_actor.
       * lo_splice_actor copies data to the target page.
       * lo_splice_actor calls flush_dcache_page because the page may be
         mapped by userspace.  In that case we need to flush the kernel cache.
       * flush_dcache_page asks for the list of userspace mappings, however
         that page->mapping field is reused by the slab subsystem for a
         different purpose.  This causes the crash.
      
      Note that other architectures without coherent caches (sparc, arm, mips)
      also call page_mapping from flush_dcache_page, so they may crash in the
      same way.
      
      This patch fixes this bug by testing if the page is a slab page in
      page_mapping and returning NULL if it is.
      
      The patch also fixes VM_BUG_ON(PageSlab(page)) that could happen in
      earlier kernels in the same scenario on architectures without cache
      coherence when CONFIG_DEBUG_VM is enabled - so it should be backported
      to stable kernels.
      
      In the old kernels, the function page_mapping is placed in
      include/linux/mm.h, so you should modify the patch accordingly when
      backporting it.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: John David Anglin <dave.anglin@bell.net>]
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Christoph Lameter <cl@linux.com>
      Acked-by: default avatarPekka Enberg <penberg@kernel.org>
      Reviewed-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      03e5ac2f
    • Aaro Koskinen's avatar
      MIPS: fix blast_icache32 on loongson2 · 43a06847
      Aaro Koskinen authored
      Commit 14bd8c08
      
       ("MIPS: Loongson: Get rid of Loongson 2 #ifdefery
      all over arch/mips") failed to add Loongson2 specific blast_icache32
      functions.  Fix that.
      
      The patch fixes the following crash seen with 3.13-rc1:
      
        Reserved instruction in kernel code[#1]:
        [...]
        Call Trace:
          blast_icache32_page+0x8/0xb0
          r4k_flush_cache_page+0x19c/0x200
          do_wp_page.isra.97+0x47c/0xe08
          handle_mm_fault+0x938/0x1118
          __do_page_fault+0x140/0x540
          resume_userspace_check+0x0/0x10
        Code: 00200825  64834000  00200825 <bc900000> bc900020  bc900040  bc900060  bc900080  bc9000a0
      
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Reviewed-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Acked-by: default avatarJohn Crispin <blogic@openwrt.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      43a06847
    • Huacai Chen's avatar
      MIPS: fix case mismatch in local_r4k_flush_icache_range() · bad009fe
      Huacai Chen authored
      Currently, Loongson-2 call protected_blast_icache_range() and others
      call protected_loongson23_blast_icache_range(), but I think the correct
      behavior should be the opposite.  BTW, Loongson-3's cache-ops is
      compatible with MIPS64, but not compatible with Loongson-2.  So, rename
      xxx_loongson23_yyy things to xxx_loongson2_yyy.
      
      The patch fixes early boot hang with 3.13-rc1, introduced in commit
      14bd8c08
      
       ("MIPS: Loongson: Get rid of Loongson 2 #ifdefery all over
      arch/mips").
      
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
      Reviewed-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Acked-by: default avatarJohn Crispin <blogic@openwrt.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bad009fe
    • Andreas Rohner's avatar
      nilfs2: fix segctor bug that causes file system corruption · 70f2fe3a
      Andreas Rohner authored
      
      
      There is a bug in the function nilfs_segctor_collect, which results in
      active data being written to a segment, that is marked as clean.  It is
      possible, that this segment is selected for a later segment
      construction, whereby the old data is overwritten.
      
      The problem shows itself with the following kernel log message:
      
        nilfs_sufile_do_cancel_free: segment 6533 must be clean
      
      Usually a few hours later the file system gets corrupted:
      
        NILFS: bad btree node (blocknr=8748107): level = 0, flags = 0x0, nchildren = 0
        NILFS error (device sdc1): nilfs_bmap_last_key: broken bmap (inode number=114660)
      
      The issue can be reproduced with a file system that is nearly full and
      with the cleaner running, while some IO intensive task is running.
      Although it is quite hard to reproduce.
      
      This is what happens:
      
       1. The cleaner starts the segment construction
       2. nilfs_segctor_collect is called
       3. sc_stage is on NILFS_ST_SUFILE and segments are freed
       4. sc_stage is on NILFS_ST_DAT current segment is full
       5. nilfs_segctor_extend_segments is called, which
          allocates a new segment
       6. The new segment is one of the segments freed in step 3
       7. nilfs_sufile_cancel_freev is called and produces an error message
       8. Loop around and the collection starts again
       9. sc_stage is on NILFS_ST_SUFILE and segments are freed
          including the newly allocated segment, which will contain active
          data and can be allocated at a later time
      10. A few hours later another segment construction allocates the
          segment and causes file system corruption
      
      This can be prevented by simply reordering the statements.  If
      nilfs_sufile_cancel_freev is called before nilfs_segctor_extend_segments
      the freed segments are marked as dirty and cannot be allocated any more.
      
      Signed-off-by: default avatarAndreas Rohner <andreas.rohner@gmx.net>
      Reviewed-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Tested-by: default avatarAndreas Rohner <andreas.rohner@gmx.net>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      70f2fe3a
    • Dave Airlie's avatar
      Merge branch 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes · 703a8c2d
      Dave Airlie authored
      Single regression fix for nouveau
      
      * 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6:
        drm/nouveau: fix null ptr dereferences on some boards
      703a8c2d
    • Ben Skeggs's avatar
      drm/nouveau: fix null ptr dereferences on some boards · fdd239ac
      Ben Skeggs authored
      
      
      Regression from "device: populate master subdev pointer only when fully
      constructed"
      
      Reported-by: default avatarBob Gleitsmann <rjgleits@bellsouth.net>
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      fdd239ac
  2. Jan 14, 2014
    • NeilBrown's avatar
      md: fix problem when adding device to read-only array with bitmap. · 8313b8e5
      NeilBrown authored
      If an array is started degraded, and then the missing device
      is found it can be re-added and a minimal bitmap-based recovery
      will bring it fully up-to-date.
      
      If the array is read-only a recovery would not be allowed.
      But also if the array is read-only and the missing device was
      present very recently, then there could be no need for any
      recovery at all, so we simply include the device in the read-only
      array without any recovery.
      
      However... if the missing device was removed a little longer ago
      it could be missing some updates, but if a bitmap is present it will
      be conditionally accepted pending a bitmap-based update.  We don't
      currently detect this case properly and will include that old
      device into the read-only array with no recovery even though it really
      needs a recovery.
      
      This patch keeps track of whether a bitmap-based-recovery is really
      needed or not in the new Bitmap_sync rdev flag.  If that is set,
      then the device will not be added to a read-only array.
      
      Cc: Andrei Warkentin <andreiw@vmware.com>
      Fixes: d70ed2e4
      
      
      Cc: stable@vger.kernel.org (3.2+)
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      8313b8e5
    • NeilBrown's avatar
      md/raid10: fix bug when raid10 recovery fails to recover a block. · e8b84915
      NeilBrown authored
      commit e875ecea
          md/raid10 record bad blocks as needed during recovery.
      
      added code to the "cannot recover this block" path to record a bad
      block rather than fail the whole recovery.
      Unfortunately this new case was placed *after* r10bio was freed rather
      than *before*, yet it still uses r10bio.
      This is will crash with a null dereference.
      
      So move the freeing of r10bio down where it is safe.
      
      Cc: stable@vger.kernel.org (v3.1+)
      Fixes: e875ecea
      
      
      Reported-by: default avatarDamian Nowak <spam@nowaker.net>
      URL: https://bugzilla.kernel.org/show_bug.cgi?id=68181
      
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      e8b84915
    • NeilBrown's avatar
      md/raid5: fix a recently broken BUG_ON(). · 5af9bef7
      NeilBrown authored
      commit 6d183de4
          md/raid5: fix newly-broken locking in get_active_stripe.
      
      simplified a BUG_ON, but removed too much so now it sometimes fires
      when it shouldn't.
      
      When the STRIPE_EXPANDING flag is set, the stripe_head might be on a
      special list while multiple stripe_heads are collected, or it might
      not be on any list, even a 'free' list when the refcount is zero.  As
      long as STRIPE_EXPANDING is set, it will be found and added back to a
      list eventually.
      
      So both of the BUG_ONs which test for the ->lru being empty or not
      need to avoid the case where STRIPE_EXPANDING is set.
      
      The patch which broke this was marked for -stable, so this patch needs
      to be applied to any branch that received 6d183de4
      
      Fixes: 6d183de4
      
      
      Cc: stable@vger.kernel.org (any release to which above was applied)
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      5af9bef7
    • NeilBrown's avatar
      md/raid1: fix request counting bug in new 'barrier' code. · 41a336e0
      NeilBrown authored
      
      
      The new iobarrier implementation in raid1 (which keeps normal writes
      and resync activity separate) counts every request what is not before
      the current resync point in either next_window_requests or
      current_window_requests.
      It flags that the request is counted by setting ->start_next_window.
      
      allow_barrier follows this model exactly and decrements one of the
      *_window_requests if and only if ->start_next_window is set.
      
      However wait_barrier(), which increments *_window_requests uses a
      slightly different test for setting -.start_next_window (which is set
      from the return value of this function).
      So there is a possibility of the counts getting out of sync, and this
      leads to the resync hanging.
      
      So change wait_barrier() to return a non-zero value in exactly the
      same cases that it increments *_window_requests.
      
      But was introduced in 3.13-rc1.
      
      Reported-by: default avatarBruno Wolff III <bruno@wolff.to>
      URL: https://bugzilla.kernel.org/show_bug.cgi?id=68061
      Fixes: 79ef3a8a
      
      
      Cc: majianpeng <majianpeng@gmail.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      41a336e0
    • NeilBrown's avatar
      md/raid10: fix two bugs in handling of known-bad-blocks. · b50c259e
      NeilBrown authored
      If we discover a bad block when reading we split the request and
      potentially read some of it from a different device.
      
      The code path of this has two bugs in RAID10.
      1/ we get a spin_lock with _irq, but unlock without _irq!!
      2/ The calculation of 'sectors_handled' is wrong, as can be clearly
         seen by comparison with raid1.c
      
      This leads to at least 2 warnings and a probable crash is a RAID10
      ever had known bad blocks.
      
      Cc: stable@vger.kernel.org (v3.1+)
      Fixes: 856e08e2
      
      
      Reported-by: default avatarDamian Nowak <spam@nowaker.net>
      URL: https://bugzilla.kernel.org/show_bug.cgi?id=68181
      
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      b50c259e
    • NeilBrown's avatar
      md/raid5: Fix possible confusion when multiple write errors occur. · 1cc03eb9
      NeilBrown authored
      commit 5d8c71f9
          md: raid5 crash during degradation
      
      Fixed a crash in an overly simplistic way which could leave
      R5_WriteError or R5_MadeGood set in the stripe cache for devices
      for which it is no longer relevant.
      When those devices are removed and spares added the flags are still
      set and can cause incorrect behaviour.
      
      commit 14a75d3e
      
      
          md/raid5: preferentially read from replacement device if possible.
      
      Fixed the same bug if a more effective way, so we can now revert
      the original commit.
      
      Reported-and-tested-by: default avatarAlexander Lyakas <alex.bolshoy@gmail.com>
      Cc: stable@vger.kernel.org (3.2+ - 3.2 will need a different fix though)
      Fixes: 5d8c71f9
      
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      1cc03eb9
    • Dave Airlie's avatar
      Revert "drm: copy mode type in drm_mode_connector_list_update()" · abce1ec9
      Dave Airlie authored
      This reverts commit 3fbd6439
      
      .
      
      This caused some strange booting lockup issues on an Intel G33
      belonging to Daniel Vetter, very unusual, I was hoping Daniel
      would track this down, but it looks like instead I'll have to hack
      a different fix for -next.
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      abce1ec9
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2014-01-13' of... · c0eeb856
      Dave Airlie authored
      Merge tag 'drm-intel-fixes-2014-01-13' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes
      
      Black screen fixes, one for hsw+bdw each and a regression fix for
      locking+load detection.
      
      * tag 'drm-intel-fixes-2014-01-13' of git://people.freedesktop.org/~danvet/drm-intel:
        drm/i915/bdw: make sure south port interrupts are enabled properly v2
        drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
        drm/i915: fix DDI PLLs HW state readout code
      c0eeb856
  3. Jan 13, 2014
  4. Jan 12, 2014
    • Linus Torvalds's avatar
      Linux 3.13-rc8 · 7e22e911
      Linus Torvalds authored
      7e22e911
    • Steven Rostedt's avatar
      SELinux: Fix possible NULL pointer dereference in selinux_inode_permission() · 3dc91d43
      Steven Rostedt authored
      While running stress tests on adding and deleting ftrace instances I hit
      this bug:
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
        IP: selinux_inode_permission+0x85/0x160
        PGD 63681067 PUD 7ddbe067 PMD 0
        Oops: 0000 [#1] PREEMPT
        CPU: 0 PID: 5634 Comm: ftrace-test-mki Not tainted 3.13.0-rc4-test-00033-gd2a6dde-dirty #20
        Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006
        task: ffff880078375800 ti: ffff88007ddb0000 task.ti: ffff88007ddb0000
        RIP: 0010:[<ffffffff812d8bc5>]  [<ffffffff812d8bc5>] selinux_inode_permission+0x85/0x160
        RSP: 0018:ffff88007ddb1c48  EFLAGS: 00010246
        RAX: 0000000000000000 RBX: 0000000000800000 RCX: ffff88006dd43840
        RDX: 0000000000000001 RSI: 0000000000000081 RDI: ffff88006ee46000
        RBP: ffff88007ddb1c88 R08: 0000000000000000 R09: ffff88007ddb1c54
        R10: 6e6576652f6f6f66 R11: 0000000000000003 R12: 0000000000000000
        R13: 0000000000000081 R14: ffff88006ee46000 R15: 0000000000000000
        FS:  00007f217b5b6700(0000) GS:ffffffff81e21000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033^M
        CR2: 0000000000000020 CR3: 000000006a0fe000 CR4: 00000000000007f0
        Call Trace:
          security_inode_permission+0x1c/0x30
          __inode_permission+0x41/0xa0
          inode_permission+0x18/0x50
          link_path_walk+0x66/0x920
          path_openat+0xa6/0x6c0
          do_filp_open+0x43/0xa0
          do_sys_open+0x146/0x240
          SyS_open+0x1e/0x20
          system_call_fastpath+0x16/0x1b
        Code: 84 a1 00 00 00 81 e3 00 20 00 00 89 d8 83 c8 02 40 f6 c6 04 0f 45 d8 40 f6 c6 08 74 71 80 cf 02 49 8b 46 38 4c 8d 4d cc 45 31 c0 <0f> b7 50 20 8b 70 1c 48 8b 41 70 89 d9 8b 78 04 e8 36 cf ff ff
        RIP  selinux_inode_permission+0x85/0x160
        CR2: 0000000000000020
      
      Investigating, I found that the inode->i_security was NULL, and the
      dereference of it caused the oops.
      
      in selinux_inode_permission():
      
      	isec = inode->i_security;
      
      	rc = avc_has_perm_noaudit(sid, isec->sid, isec->sclass, perms, 0, &avd);
      
      Note, the crash came from stressing the deletion and reading of debugfs
      files.  I was not able to recreate this via normal files.  But I'm not
      sure they are safe.  It may just be that the race window is much harder
      to hit.
      
      What seems to have happened (and what I have traced), is the file is
      being opened at the same time the file or directory is being deleted.
      As the dentry and inode locks are not held during the path walk, nor is
      the inodes ref counts being incremented, there is nothing saving these
      structures from being discarded except for an rcu_read_lock().
      
      The rcu_read_lock() protects against freeing of the inode, but it does
      not protect freeing of the inode_security_struct.  Now if the freeing of
      the i_security happens with a call_rcu(), and the i_security field of
      the inode is not changed (it gets freed as the inode gets freed) then
      there will be no issue here.  (Linus Torvalds suggested not setting the
      field to NULL such that we do not need to check if it is NULL in the
      permission check).
      
      Note, this is a hack, but it fixes the problem at hand.  A real fix is
      to restructure the destroy_inode() to call all the destructor handlers
      from the RCU callback.  But that is a major job to do, and requires a
      lot of work.  For now, we just band-aid this bug with this fix (it
      works), and work on a more maintainable solution in the future.
      
      Link: http://lkml.kernel.org/r/20140109101932.0508dec7@gandalf.local.home
      Link: http://lkml.kernel.org/r/20140109182756.17abaaa8@gandalf.local.home
      
      
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3dc91d43
    • Hugh Dickins's avatar
      thp: fix copy_page_rep GPF by testing is_huge_zero_pmd once only · eecc1e42
      Hugh Dickins authored
      We see General Protection Fault on RSI in copy_page_rep: that RSI is
      what you get from a NULL struct page pointer.
      
        RIP: 0010:[<ffffffff81154955>]  [<ffffffff81154955>] copy_page_rep+0x5/0x10
        RSP: 0000:ffff880136e15c00  EFLAGS: 00010286
        RAX: ffff880000000000 RBX: ffff880136e14000 RCX: 0000000000000200
        RDX: 6db6db6db6db6db7 RSI: db73880000000000 RDI: ffff880dd0c00000
        RBP: ffff880136e15c18 R08: 0000000000000200 R09: 000000000005987c
        R10: 000000000005987c R11: 0000000000000200 R12: 0000000000000001
        R13: ffffea00305aa000 R14: 0000000000000000 R15: 0000000000000000
        FS:  00007f195752f700(0000) GS:ffff880c7fc20000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000093010000 CR3: 00000001458e1000 CR4: 00000000000027e0
        Call Trace:
          copy_user_huge_page+0x93/0xab
          do_huge_pmd_wp_page+0x710/0x815
          handle_mm_fault+0x15d8/0x1d70
          __do_page_fault+0x14d/0x840
          do_page_fault+0x2f/0x90
          page_fault+0x22/0x30
      
      do_huge_pmd_wp_page() tests is_huge_zero_pmd(orig_pmd) four times: but
      since shrink_huge_zero_page() can free the huge_zero_page, and we have
      no hold of our own on it here (except where the fourth test holds
      page_table_lock and has checked pmd_same), it's possible for it to
      answer yes the first time, but no to the second or third test.  Change
      all those last three to tests for NULL page.
      
      (Note: this is not the same issue as trinity's DEBUG_PAGEALLOC BUG
      in copy_page_rep with RSI: ffff88009c422000, reported by Sasha Levin
      in https://lkml.org/lkml/2013/3/29/103.  I believe that one is due
      to the source page being split, and a tail page freed, while copy
      is in progress; and not a problem without DEBUG_PAGEALLOC, since
      the pmd_same check will prevent a miscopy from being made visible.)
      
      Fixes: 97ae1749
      
       ("thp: implement refcounting for huge zero page")
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Cc: stable@vger.kernel.org # v3.10 v3.11 v3.12
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eecc1e42
    • Ming Lei's avatar
      block: null_blk: fix queue leak inside removing device · 518d00b7
      Ming Lei authored
      
      
      When queue_mode is NULL_Q_MQ and null_blk is being removed,
      blk_cleanup_queue() isn't called to cleanup queue, so the queue
      allocated won't be freed.
      
      This patch calls blk_cleanup_queue() for MQ to drain all pending
      requests first and release the reference counter of queue kobject, then
      blk_mq_free_queue() will be called in queue kobject's release handler
      when queue kobject's reference counter drops to zero.
      
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      518d00b7
    • Linus Torvalds's avatar
      x86, fpu, amd: Clear exceptions in AMD FXSAVE workaround · 26bef131
      Linus Torvalds authored
      
      
      Before we do an EMMS in the AMD FXSAVE information leak workaround we
      need to clear any pending exceptions, otherwise we trap with a
      floating-point exception inside this code.
      
      Reported-by: default avatarhalfdog <me@halfdog.net>
      Tested-by: default avatarBorislav Petkov <bp@suse.de>
      Link: http://lkml.kernel.org/r/CA%2B55aFxQnY_PCG_n4=0w-VG=YLXL-yr7oMxyy0WU2gCBAf3ydg@mail.gmail.com
      
      
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      26bef131
  5. Jan 11, 2014
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 228fdc08
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Famouse last words: "final pull request" :-)
      
        I'm sending this because Jason Wang's fixes are pretty important
      
         1) Add missing per-cpu stats initialization to ip6_vti.  Otherwise
            lockdep spits out a call trace.  From Li RongQing.
      
         2) Fix NULL oops in wireless hwsim, from Javier Lopez
      
         3) TIPC deferred packet queue unlink must NULL out skb->next to avoid
            crashes.  From Erik Hugne
      
         4) Fix access to uninitialized buffer in nf_nat netfilter code, from
            Daniel Borkmann
      
         5) Fix lifetime of ipv6 loopback and SIT tunnel addresses, otherwise
            they basically timeout immediately.  From Hannes Frederic Sowa
      
         6) Fix DMA unmapping of TSO packets in bnx2x driver, from Michal
            Schmidt
      
         7) Do not allow L2 forwarding offload via macvtap device, the way
            things are now it will not end up being forwaded at all.  From
            Jason Wang
      
         8) Fix transmit queue selection via ndo_dfwd_start_xmit(), fixing
            things like applying NETIF_F_LLTX to the wrong device (!!) and
            eliding the proper transmit watchdog handling
      
         9) qlcnic driver was not updating tx statistics at all, from Manish
            Chopra"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        qlcnic: Fix ethtool statistics length calculation
        qlcnic: Fix bug in TX statistics
        net: core: explicitly select a txq before doing l2 forwarding
        macvlan: forbid L2 fowarding offload for macvtap
        bnx2x: fix DMA unmapping of TSO split BDs
        ipv6: add link-local, sit and loopback address with INFINITY_LIFE_TIME
        bnx2x: prevent WARN during driver unload
        tipc: correctly unlink packets from deferred packet queue
        ipv6: pcpu_tstats.syncp should be initialised in ip6_vti.c
        netfilter: only warn once on wrong seqadj usage
        netfilter: nf_nat: fix access to uninitialized buffer in IRC NAT helper
        NFC: Fix target mode p2p link establishment
        iwlwifi: add new devices for 7265 series
        mac80211: move "bufferable MMPDU" check to fix AP mode scan
        mac80211_hwsim: Fix NULL pointer dereference
      228fdc08
    • Linus Torvalds's avatar
      Merge tag 'xfs-for-linus-v3.13-rc8' of git://oss.sgi.com/xfs/xfs · e2bc4470
      Linus Torvalds authored
      Pull xfs bugfixes from Ben Myers:
       "Here we have a bugfix for an off-by-one in the remote attribute
        verifier that results in a forced shutdown which you can hit with v5
        superblock by creating a 64k xattr, and a fix for a missing
        destroy_work_on_stack() in the allocation worker.
      
        It's a bit late, but they are both fairly straightforward"
      
      * tag 'xfs-for-linus-v3.13-rc8' of git://oss.sgi.com/xfs/xfs:
        xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK()
        xfs: fix off-by-one error in xfs_attr3_rmt_verify
      e2bc4470
    • Linus Torvalds's avatar
      Merge branch 'leds-fixes-for-3.13' of... · 324c66ff
      Linus Torvalds authored
      Merge branch 'leds-fixes-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
      
      Pull LED fix from Bryan Wu:
       "Pali Rohár and Pavel Machek reported the LED of Nokia N900 doesn't
        work with our latest 3.13-rc6 kernel.  Milo fixed the regression here"
      
      * 'leds-fixes-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
        leds: lp5521/5523: Remove duplicate mutex
      324c66ff
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-3.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · cff539b1
      Linus Torvalds authored
      Pull ACPI and power management fixes from Rafael Wysocki:
      
       - Recent commits modifying the lists of C-states in the intel_idle
         driver introduced bugs leading to crashes on some systems.  Two fixes
         from Jiang Liu.
      
       - The ACPI AC driver should receive all types of notifications, but
         recent change made it ignore some of them.  Fix from Alexander Mezin.
      
       - intel_pstate's validity checks for MSRs it depends on are not
         sufficient to catch the lack of support in nested KVM setups, so they
         are extended to cover that case.  From Dirk Brandewie.
      
       - NEC LZ750/LS has a botched up _BIX method in its ACPI tables, so our
         ACPI battery driver needs a quirk for it.  From Lan Tianyu.
      
       - The tpm_ppi driver sometimes leaks memory allocated by
         acpi_get_name().  Fix from Jiang Liu.
      
      * tag 'pm+acpi-3.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        intel_idle: close avn_cstates array with correct marker
        Revert "intel_idle: mark states tables with __initdata tag"
        ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS
        intel_pstate: Add X86_FEATURE_APERFMPERF to cpu match parameters.
        ACPI / TPM: fix memory leak when walking ACPI namespace
        ACPI / AC: change notification handler type to ACPI_ALL_NOTIFY
      cff539b1
    • Linus Torvalds's avatar
      Merge tag 'mfd-fixes-3.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-fixes · c43a5eb2
      Linus Torvalds authored
      Pull MFD fix from Samuel Ortiz:
       "This is the 2nd MFD pull request for 3.13
      
        It only contains one fix for the rtsx_pcr driver.  Without it we see a
        kernel panic on some machines, when resuming from suspend to RAM"
      
      * tag 'mfd-fixes-3.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-fixes:
        mfd: rtsx_pcr: Disable interrupts before cancelling delayed works
      c43a5eb2
    • Milo Kim's avatar
      leds: lp5521/5523: Remove duplicate mutex · e70988d1
      Milo Kim authored
      
      
      It can be a problem when a pattern is loaded via the firmware interface.
      LP55xx common driver has already locked the mutex in 'lp55xx_firmware_loaded()'.
      So it should be deleted.
      
      On the other hand, locks are required in store_engine_load()
      on updating program memory.
      
      Reported-by: default avatarPali Rohár <pali.rohar@gmail.com>
      Reported-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarMilo Kim <milo.kim@ti.com>
      Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
      Cc: <stable@vger.kernel.org>
      e70988d1
    • Jesse Barnes's avatar
      drm/i915/bdw: make sure south port interrupts are enabled properly v2 · 09f2344d
      Jesse Barnes authored
      We were apparently relying on the defaults on BDW, which resulted in no
      hotplug or AUX interrupts.  So be sure to call the ibx_irq_preinstall to
      enable all interrupts.
      
      v2: use preinstall instead of redundant SDIER write
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=72834
      References: https://bugs.freedesktop.org/show_bug.cgi?id=72833
      
      
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      09f2344d
    • Chuansheng Liu's avatar
      xfs: Calling destroy_work_on_stack() to pair with INIT_WORK_ONSTACK() · 1f4a63bf
      Chuansheng Liu authored
      
      
      In case CONFIG_DEBUG_OBJECTS_WORK is defined, it is needed to
      call destroy_work_on_stack() which frees the debug object to pair
      with INIT_WORK_ONSTACK().
      
      Signed-off-by: default avatarLiu, Chuansheng <chuansheng.liu@intel.com>
      Reviewed-by: default avatarBen Myers <bpm@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      
      (cherry picked from commit 6f96b306)
      1f4a63bf
    • Jie Liu's avatar
      xfs: fix off-by-one error in xfs_attr3_rmt_verify · bba719b5
      Jie Liu authored
      
      
      With CRC check is enabled, if trying to set an attributes value just
      equal to the maximum size of XATTR_SIZE_MAX would cause the v3 remote
      attr write verification procedure failure, which would yield the back
      trace like below:
      
      <snip>
      XFS (sda7): Internal error xfs_attr3_rmt_write_verify at line 191 of file fs/xfs/xfs_attr_remote.c
      <snip>
      Call Trace:
      [<ffffffff816f0042>] dump_stack+0x45/0x56
      [<ffffffffa0d99c8b>] xfs_error_report+0x3b/0x40 [xfs]
      [<ffffffffa0d96edd>] ? _xfs_buf_ioapply+0x6d/0x390 [xfs]
      [<ffffffffa0d99ce5>] xfs_corruption_error+0x55/0x80 [xfs]
      [<ffffffffa0dbef6b>] xfs_attr3_rmt_write_verify+0x14b/0x1a0 [xfs]
      [<ffffffffa0d96edd>] ? _xfs_buf_ioapply+0x6d/0x390 [xfs]
      [<ffffffffa0d97315>] ? xfs_bdstrat_cb+0x55/0xb0 [xfs]
      [<ffffffffa0d96edd>] _xfs_buf_ioapply+0x6d/0x390 [xfs]
      [<ffffffff81184cda>] ? vm_map_ram+0x31a/0x460
      [<ffffffff81097230>] ? wake_up_state+0x20/0x20
      [<ffffffffa0d97315>] ? xfs_bdstrat_cb+0x55/0xb0 [xfs]
      [<ffffffffa0d9726b>] xfs_buf_iorequest+0x6b/0xc0 [xfs]
      [<ffffffffa0d97315>] xfs_bdstrat_cb+0x55/0xb0 [xfs]
      [<ffffffffa0d97906>] xfs_bwrite+0x46/0x80 [xfs]
      [<ffffffffa0dbfa94>] xfs_attr_rmtval_set+0x334/0x490 [xfs]
      [<ffffffffa0db84aa>] xfs_attr_leaf_addname+0x24a/0x410 [xfs]
      [<ffffffffa0db8893>] xfs_attr_set_int+0x223/0x470 [xfs]
      [<ffffffffa0db8b76>] xfs_attr_set+0x96/0xb0 [xfs]
      [<ffffffffa0db13b2>] xfs_xattr_set+0x42/0x70 [xfs]
      [<ffffffff811df9b2>] generic_setxattr+0x62/0x80
      [<ffffffff811e0213>] __vfs_setxattr_noperm+0x63/0x1b0
      [<ffffffff81307afe>] ? evm_inode_setxattr+0xe/0x10
      [<ffffffff811e0415>] vfs_setxattr+0xb5/0xc0
      [<ffffffff811e054e>] setxattr+0x12e/0x1c0
      [<ffffffff811c6e82>] ? final_putname+0x22/0x50
      [<ffffffff811c708b>] ? putname+0x2b/0x40
      [<ffffffff811cc4bf>] ? user_path_at_empty+0x5f/0x90
      [<ffffffff811bdfd9>] ? __sb_start_write+0x49/0xe0
      [<ffffffff81168589>] ? vm_mmap_pgoff+0x99/0xc0
      [<ffffffff811e07df>] SyS_setxattr+0x8f/0xe0
      [<ffffffff81700c2d>] system_call_fastpath+0x1a/0x1f
      
      Tests:
          setfattr -n user.longxattr -v `perl -e 'print "A"x65536'` testfile
      
      This patch fix it to check the remote EA size is greater than the
      XATTR_SIZE_MAX rather than more than or equal to it, because it's
      valid if the specified EA value size is equal to the limitation as
      per VFS setxattr interface.
      
      Signed-off-by: default avatarJie Liu <jeff.liu@oracle.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      
      (cherry picked from commit 85dd0707)
      bba719b5
    • Shahed Shaikh's avatar
      qlcnic: Fix ethtool statistics length calculation · d6e9c89a
      Shahed Shaikh authored
      
      
      o Consider number of Tx queues while calculating the length of
        Tx statistics as part of ethtool stats.
      o Calculate statistics lenght properly for 82xx and 83xx adapter
      
      Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6e9c89a
    • Manish Chopra's avatar
      qlcnic: Fix bug in TX statistics · 1ac6762a
      Manish Chopra authored
      
      
      o Driver was not updating TX stats so it was not populating
        statistics in `ifconfig` command output.
      
      Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ac6762a
    • Jason Wang's avatar
      net: core: explicitly select a txq before doing l2 forwarding · f663dd9a
      Jason Wang authored
      
      
      Currently, the tx queue were selected implicitly in ndo_dfwd_start_xmit(). The
      will cause several issues:
      
      - NETIF_F_LLTX were removed for macvlan, so txq lock were done for macvlan
        instead of lower device which misses the necessary txq synchronization for
        lower device such as txq stopping or frozen required by dev watchdog or
        control path.
      - dev_hard_start_xmit() was called with NULL txq which bypasses the net device
        watchdog.
      - dev_hard_start_xmit() does not check txq everywhere which will lead a crash
        when tso is disabled for lower device.
      
      Fix this by explicitly introducing a new param for .ndo_select_queue() for just
      selecting queues in the case of l2 forwarding offload. netdev_pick_tx() was also
      extended to accept this parameter and dev_queue_xmit_accel() was used to do l2
      forwarding transmission.
      
      With this fixes, NETIF_F_LLTX could be preserved for macvlan and there's no need
      to check txq against NULL in dev_hard_start_xmit(). Also there's no need to keep
      a dedicated ndo_dfwd_start_xmit() and we can just reuse the code of
      dev_queue_xmit() to do the transmission.
      
      In the future, it was also required for macvtap l2 forwarding support since it
      provides a necessary synchronization method.
      
      Cc: John Fastabend <john.r.fastabend@intel.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: e1000-devel@lists.sourceforge.net
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Acked-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f663dd9a
    • Jason Wang's avatar
      macvlan: forbid L2 fowarding offload for macvtap · b13ba1b8
      Jason Wang authored
      
      
      L2 fowarding offload will bypass the rx handler of real device. This will make
      the packet could not be forwarded to macvtap device. Another problem is the
      dev_hard_start_xmit() called for macvtap does not have any synchronization.
      
      Fix this by forbidding L2 forwarding for macvtap.
      
      Cc: John Fastabend <john.r.fastabend@intel.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Acked-by: default avatarJohn Fastabend <john.r.fastabend@intel.com.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b13ba1b8