1. 03 Jan, 2014 40 commits
    • Larry Finger's avatar
      rtlwifi: rtl8192cu: Fix incorrect signal strength for unassociated AP · 44025275
      Larry Finger authored
      commit 78dbfecb upstream.
      
      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.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      44025275
    • Larry Finger's avatar
      rtlwifi: rtl8192se: Fix incorrect signal strength for unassociated AP · dec25887
      Larry Finger authored
      commit b4ade797 upstream.
      
      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>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      dec25887
    • Mark Cave-Ayland's avatar
      rtlwifi: Fix endian error in extracting packet type · 8e1028cb
      Mark Cave-Ayland authored
      commit 0c5d63f0 upstream.
      
      All of the rtlwifi drivers have an error in the routine that tests if
      the data is "special". If it is, the subsequant transmission will be
      at the lowest rate to enhance reliability. The 16-bit quantity is
      big-endian, but was being extracted in native CPU mode. One of the
      effects of this bug is to inhibit association under some conditions
      as the TX rate is too high.
      
      Based on suggestions by Joe Perches, the entire routine is rewritten.
      
      One of the local headers contained duplicates of some of the ETH_P_XXX
      definitions. These are deleted.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      [bwh: Backported to 3.2: adjust context; use rtl_lps_leave()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8e1028cb
    • Felipe Pena's avatar
      rtlwifi: rtl8192se: Fix wrong assignment · d0086d12
      Felipe Pena authored
      commit 3aef7dde upstream.
      
      There is a typo in the struct member name on assignment when checking
      rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses pwrgroup_ht40
      for bound limit and uses pwrgroup_ht20 when assigning instead.
      Signed-off-by: default avatarFelipe Pena <felipensp@gmail.com>
      Acked-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d0086d12
    • Jan Kara's avatar
      IB/qib: Convert qib_user_sdma_pin_pages() to use get_user_pages_fast() · 434700a2
      Jan Kara authored
      commit 603e7729 upstream.
      
      qib_user_sdma_queue_pkts() gets called with mmap_sem held for
      writing. Except for get_user_pages() deep down in
      qib_user_sdma_pin_pages() we don't seem to need mmap_sem at all.  Even
      more interestingly the function qib_user_sdma_queue_pkts() (and also
      qib_user_sdma_coalesce() called somewhat later) call copy_from_user()
      which can hit a page fault and we deadlock on trying to get mmap_sem
      when handling that fault.
      
      So just make qib_user_sdma_pin_pages() use get_user_pages_fast() and
      leave mmap_sem locking for mm.
      
      This deadlock has actually been observed in the wild when the node
      is under memory pressure.
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - Adjust indentation and nr_pages argument in qib_user_sdma_pin_pages()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      434700a2
    • Jan Kara's avatar
      IB/ipath: Convert ipath_user_sdma_pin_pages() to use get_user_pages_fast() · 0ecfc95d
      Jan Kara authored
      commit 4adcf7fb upstream.
      
      ipath_user_sdma_queue_pkts() gets called with mmap_sem held for
      writing.  Except for get_user_pages() deep down in
      ipath_user_sdma_pin_pages() we don't seem to need mmap_sem at all.
      
      Even more interestingly the function ipath_user_sdma_queue_pkts() (and
      also ipath_user_sdma_coalesce() called somewhat later) call
      copy_from_user() which can hit a page fault and we deadlock on trying
      to get mmap_sem when handling that fault.  So just make
      ipath_user_sdma_pin_pages() use get_user_pages_fast() and leave
      mmap_sem locking for mm.
      
      This deadlock has actually been observed in the wild when the node
      is under memory pressure.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      
      [ Merged in fix for call to get_user_pages_fast from Tetsuo Handa
        <penguin-kernel@I-love.SAKURA.ne.jp>.  - Roland ]
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0ecfc95d
    • Trond Myklebust's avatar
      SUNRPC: Fix a data corruption issue when retransmitting RPC calls · 628b0a15
      Trond Myklebust authored
      commit a6b31d18 upstream.
      
      The following scenario can cause silent data corruption when doing
      NFS writes. It has mainly been observed when doing database writes
      using O_DIRECT.
      
      1) The RPC client uses sendpage() to do zero-copy of the page data.
      2) Due to networking issues, the reply from the server is delayed,
         and so the RPC client times out.
      
      3) The client issues a second sendpage of the page data as part of
         an RPC call retransmission.
      
      4) The reply to the first transmission arrives from the server
         _before_ the client hardware has emptied the TCP socket send
         buffer.
      5) After processing the reply, the RPC state machine rules that
         the call to be done, and triggers the completion callbacks.
      6) The application notices the RPC call is done, and reuses the
         pages to store something else (e.g. a new write).
      
      7) The client NIC drains the TCP socket send buffer. Since the
         page data has now changed, it reads a corrupted version of the
         initial RPC call, and puts it on the wire.
      
      This patch fixes the problem in the following manner:
      
      The ordering guarantees of TCP ensure that when the server sends a
      reply, then we know that the _first_ transmission has completed. Using
      zero-copy in that situation is therefore safe.
      If a time out occurs, we then send the retransmission using sendmsg()
      (i.e. no zero-copy), We then know that the socket contains a full copy of
      the data, and so it will retransmit a faithful reproduction even if the
      RPC call completes, and the application reuses the O_DIRECT buffer in
      the meantime.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      628b0a15
    • Mikulas Patocka's avatar
      block: fix a probe argument to blk_register_region · a4304573
      Mikulas Patocka authored
      commit a207f593 upstream.
      
      The probe function is supposed to return NULL on failure (as we can see in
      kobj_lookup: kobj = probe(dev, index, data); ... if (kobj) return kobj;
      
      However, in loop and brd, it returns negative error from ERR_PTR.
      
      This causes a crash if we simulate disk allocation failure and run
      less -f /dev/loop0 because the negative number is interpreted as a pointer:
      
      BUG: unable to handle kernel NULL pointer dereference at 00000000000002b4
      IP: [<ffffffff8118b188>] __blkdev_get+0x28/0x450
      PGD 23c677067 PUD 23d6d1067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      Modules linked in: loop hpfs nvidia(PO) ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev msr ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_stats cpufreq_ondemand cpufreq_userspace cpufreq_powersave cpufreq_conservative hid_generic spadfs usbhid hid fuse raid0 snd_usb_audio snd_pcm_oss snd_mixer_oss md_mod snd_pcm snd_timer snd_page_alloc snd_hwdep snd_usbmidi_lib dmi_sysfs snd_rawmidi nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack snd soundcore lm85 hwmon_vid ohci_hcd ehci_pci ehci_hcd serverworks sata_svw libata acpi_cpufreq freq_table mperf ide_core usbcore kvm_amd kvm tg3 i2c_piix4 libphy microcode e100 usb_common ptp skge i2c_core pcspkr k10temp evdev floppy hwmon pps_core mii rtc_cmos button processor unix [last unloaded: nvidia]
      CPU: 1 PID: 6831 Comm: less Tainted: P        W  O 3.10.15-devel #18
      Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
      task: ffff880203cc6bc0 ti: ffff88023e47c000 task.ti: ffff88023e47c000
      RIP: 0010:[<ffffffff8118b188>]  [<ffffffff8118b188>] __blkdev_get+0x28/0x450
      RSP: 0018:ffff88023e47dbd8  EFLAGS: 00010286
      RAX: ffffffffffffff74 RBX: ffffffffffffff74 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
      RBP: ffff88023e47dc18 R08: 0000000000000002 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff88023f519658
      R13: ffffffff8118c300 R14: 0000000000000000 R15: ffff88023f519640
      FS:  00007f2070bf7700(0000) GS:ffff880247400000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000002b4 CR3: 000000023da1d000 CR4: 00000000000007e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Stack:
       0000000000000002 0000001d00000000 000000003e47dc50 ffff88023f519640
       ffff88043d5bb668 ffffffff8118c300 ffff88023d683550 ffff88023e47de60
       ffff88023e47dc98 ffffffff8118c10d 0000001d81605698 0000000000000292
      Call Trace:
       [<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
       [<ffffffff8118c10d>] blkdev_get+0x1dd/0x370
       [<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
       [<ffffffff813cea6c>] ? _raw_spin_unlock+0x2c/0x50
       [<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
       [<ffffffff8118c365>] blkdev_open+0x65/0x80
       [<ffffffff8114d12e>] do_dentry_open.isra.18+0x23e/0x2f0
       [<ffffffff8114d214>] finish_open+0x34/0x50
       [<ffffffff8115e122>] do_last.isra.62+0x2d2/0xc50
       [<ffffffff8115eb58>] path_openat.isra.63+0xb8/0x4d0
       [<ffffffff81115a8e>] ? might_fault+0x4e/0xa0
       [<ffffffff8115f4f0>] do_filp_open+0x40/0x90
       [<ffffffff813cea6c>] ? _raw_spin_unlock+0x2c/0x50
       [<ffffffff8116db85>] ? __alloc_fd+0xa5/0x1f0
       [<ffffffff8114e45f>] do_sys_open+0xef/0x1d0
       [<ffffffff8114e559>] SyS_open+0x19/0x20
       [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
      Code: 44 00 00 55 48 89 e5 41 57 49 89 ff 41 56 41 89 d6 41 55 41 54 4c 8d 67 18 53 48 83 ec 18 89 75 cc e9 f2 00 00 00 0f 1f 44 00 00 <48> 8b 80 40 03 00 00 48 89 df 4c 8b 68 58 e8 d5
      a4 07 00 44 89
      RIP  [<ffffffff8118b188>] __blkdev_get+0x28/0x450
       RSP <ffff88023e47dbd8>
      CR2: 00000000000002b4
      ---[ end trace bb7f32dbf02398dc ]---
      
      The brd change should be backported to stable kernels starting with 2.6.25.
      The loop change should be backported to stable kernels starting with 2.6.22.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a4304573
    • Mikulas Patocka's avatar
      loop: fix crash if blk_alloc_queue fails · ba664b2f
      Mikulas Patocka authored
      commit 3ec981e3 upstream.
      
      loop: fix crash if blk_alloc_queue fails
      
      If blk_alloc_queue fails, loop_add cleans up, but it doesn't clean up the
      identifier allocated with idr_alloc. That causes crash on module unload in
      idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); where we attempt to
      remove non-existed device with that id.
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000380
      IP: [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
      PGD 43d399067 PUD 43d0ad067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      Modules linked in: loop(-) dm_snapshot dm_zero dm_mirror dm_region_hash dm_log dm_loop dm_mod ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev msr ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_userspace cpufreq_stats cpufreq_ondemand cpufreq_conservative cpufreq_powersave spadfs fuse hid_generic usbhid hid raid0 md_mod dmi_sysfs nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack snd_usb_audio snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc lm85 hwmon_vid snd_hwdep snd_usbmidi_lib snd_rawmidi snd soundcore acpi_cpufreq ohci_hcd freq_table tg3 ehci_pci mperf ehci_hcd kvm_amd kvm sata_svw serverworks libphy libata ide_core k10temp usbcore hwmon microcode ptp pcspkr pps_core e100 skge mii usb_common i2c_piix4 floppy evdev rtc_cmos i2c_core processor but!
       ton unix
      CPU: 7 PID: 2735 Comm: rmmod Tainted: G        W    3.10.15-devel #15
      Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
      task: ffff88043d38e780 ti: ffff88043d21e000 task.ti: ffff88043d21e000
      RIP: 0010:[<ffffffff812057c9>]  [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
      RSP: 0018:ffff88043d21fe10  EFLAGS: 00010282
      RAX: ffffffffa05102e0 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffff88043ea82800 RDI: 0000000000000000
      RBP: ffff88043d21fe48 R08: 0000000000000000 R09: 0000000000000001
      R10: 0000000000000001 R11: 0000000000000000 R12: 00000000000000ff
      R13: 0000000000000080 R14: 0000000000000000 R15: ffff88043ea82800
      FS:  00007ff646534700(0000) GS:ffff880447000000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      CR2: 0000000000000380 CR3: 000000043e9bf000 CR4: 00000000000007e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Stack:
       ffffffff8100aba4 0000000000000092 ffff88043d21fe48 ffff88043ea82800
       00000000000000ff ffff88043d21fe98 0000000000000000 ffff88043d21fe60
       ffffffffa05102b4 0000000000000000 ffff88043d21fe70 ffffffffa05102ec
      Call Trace:
       [<ffffffff8100aba4>] ? native_sched_clock+0x24/0x80
       [<ffffffffa05102b4>] loop_remove+0x14/0x40 [loop]
       [<ffffffffa05102ec>] loop_exit_cb+0xc/0x10 [loop]
       [<ffffffff81217b74>] idr_for_each+0x104/0x190
       [<ffffffffa05102e0>] ? loop_remove+0x40/0x40 [loop]
       [<ffffffff8109adc5>] ? trace_hardirqs_on_caller+0x105/0x1d0
       [<ffffffffa05135dc>] loop_exit+0x34/0xa58 [loop]
       [<ffffffff810a98ea>] SyS_delete_module+0x13a/0x260
       [<ffffffff81221d5e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
       [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
      Code: f0 4c 8b 6d f8 c9 c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 56 41 55 4c 8d af 80 00 00 00 41 54 53 48 89 fb 48 83 ec 18 <48> 83 bf 80 03 00
      00 00 74 4d e8 98 fe ff ff 31 f6 48 c7 c7 20
      RIP  [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
       RSP <ffff88043d21fe10>
      CR2: 0000000000000380
      ---[ end trace 64ec069ec70f1309 ]---
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ba664b2f
    • Mikulas Patocka's avatar
      blk-core: Fix memory corruption if blkcg_init_queue fails · 9be9b3e8
      Mikulas Patocka authored
      commit fff4996b upstream.
      
      If blkcg_init_queue fails, blk_alloc_queue_node doesn't call bdi_destroy
      to clean up structures allocated by the backing dev.
      
      ------------[ cut here ]------------
      WARNING: at lib/debugobjects.c:260 debug_print_object+0x85/0xa0()
      ODEBUG: free active (active state 0) object type: percpu_counter hint:           (null)
      Modules linked in: dm_loop dm_mod ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev ipt_MASQUERADE iptable_nat nf_nat_ipv4 msr nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_ondemand cpufreq_conservative spadfs fuse hid_generic usbhid hid raid0 md_mod dmi_sysfs nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack lm85 hwmon_vid snd_usb_audio snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_hwdep snd_usbmidi_lib snd_rawmidi snd soundcore acpi_cpufreq freq_table mperf sata_svw serverworks kvm_amd ide_core ehci_pci ohci_hcd libata ehci_hcd kvm usbcore tg3 usb_common libphy k10temp pcspkr ptp i2c_piix4 i2c_core evdev microcode hwmon rtc_cmos pps_core e100 skge floppy mii processor button unix
      CPU: 0 PID: 2739 Comm: lvchange Tainted: G        W
      3.10.15-devel #14
      Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
       0000000000000009 ffff88023c3c1ae8 ffffffff813c8fd4 ffff88023c3c1b20
       ffffffff810399eb ffff88043d35cd58 ffffffff81651940 ffff88023c3c1bf8
       ffffffff82479d90 0000000000000005 ffff88023c3c1b80 ffffffff81039a67
      Call Trace:
       [<ffffffff813c8fd4>] dump_stack+0x19/0x1b
       [<ffffffff810399eb>] warn_slowpath_common+0x6b/0xa0
       [<ffffffff81039a67>] warn_slowpath_fmt+0x47/0x50
       [<ffffffff8122aaaf>] ? debug_check_no_obj_freed+0xcf/0x250
       [<ffffffff81229a15>] debug_print_object+0x85/0xa0
       [<ffffffff8122abe3>] debug_check_no_obj_freed+0x203/0x250
       [<ffffffff8113c4ac>] kmem_cache_free+0x20c/0x3a0
       [<ffffffff811f6709>] blk_alloc_queue_node+0x2a9/0x2c0
       [<ffffffff811f672e>] blk_alloc_queue+0xe/0x10
       [<ffffffffa04c0093>] dm_create+0x1a3/0x530 [dm_mod]
       [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
       [<ffffffffa04c6c07>] dev_create+0x57/0x2b0 [dm_mod]
       [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
       [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
       [<ffffffffa04c6528>] ctl_ioctl+0x268/0x500 [dm_mod]
       [<ffffffff81097662>] ? get_lock_stats+0x22/0x70
       [<ffffffffa04c67ce>] dm_ctl_ioctl+0xe/0x20 [dm_mod]
       [<ffffffff81161aad>] do_vfs_ioctl+0x2ed/0x520
       [<ffffffff8116cfc7>] ? fget_light+0x377/0x4e0
       [<ffffffff81161d2b>] SyS_ioctl+0x4b/0x90
       [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
      ---[ end trace 4b5ff0d55673d986 ]---
      ------------[ cut here ]------------
      
      This fix should be backported to stable kernels starting with 2.6.37. Note
      that in the kernels prior to 3.5 the affected code is different, but the
      bug is still there - bdi_init is called and bdi_destroy isn't.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      [bwh: Backported to 3.2: add bdi_destroy() to the single error path
       after the call to bdi_init()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9be9b3e8
    • Jeff Moyer's avatar
      block: fix race between request completion and timeout handling · c76cf3d0
      Jeff Moyer authored
      commit 4912aa6c upstream.
      
      crocode i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support shpchp ioatdma dca be2net sg ses enclosure ext4 mbcache jbd2 sd_mod crc_t10dif ahci megaraid_sas(U) dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]
      
      Pid: 491, comm: scsi_eh_0 Tainted: G        W  ----------------   2.6.32-220.13.1.el6.x86_64 #1 IBM  -[8722PAX]-/00D1461
      RIP: 0010:[<ffffffff8124e424>]  [<ffffffff8124e424>] blk_requeue_request+0x94/0xa0
      RSP: 0018:ffff881057eefd60  EFLAGS: 00010012
      RAX: ffff881d99e3e8a8 RBX: ffff881d99e3e780 RCX: ffff881d99e3e8a8
      RDX: ffff881d99e3e8a8 RSI: ffff881d99e3e780 RDI: ffff881d99e3e780
      RBP: ffff881057eefd80 R08: ffff881057eefe90 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff881057f92338
      R13: 0000000000000000 R14: ffff881057f92338 R15: ffff883058188000
      FS:  0000000000000000(0000) GS:ffff880040200000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
      CR2: 00000000006d3ec0 CR3: 000000302cd7d000 CR4: 00000000000406b0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process scsi_eh_0 (pid: 491, threadinfo ffff881057eee000, task ffff881057e29540)
      Stack:
       0000000000001057 0000000000000286 ffff8810275efdc0 ffff881057f16000
      <0> ffff881057eefdd0 ffffffff81362323 ffff881057eefe20 ffffffff8135f393
      <0> ffff881057e29af8 ffff8810275efdc0 ffff881057eefe78 ffff881057eefe90
      Call Trace:
       [<ffffffff81362323>] __scsi_queue_insert+0xa3/0x150
       [<ffffffff8135f393>] ? scsi_eh_ready_devs+0x5e3/0x850
       [<ffffffff81362a23>] scsi_queue_insert+0x13/0x20
       [<ffffffff8135e4d4>] scsi_eh_flush_done_q+0x104/0x160
       [<ffffffff8135fb6b>] scsi_error_handler+0x35b/0x660
       [<ffffffff8135f810>] ? scsi_error_handler+0x0/0x660
       [<ffffffff810908c6>] kthread+0x96/0xa0
       [<ffffffff8100c14a>] child_rip+0xa/0x20
       [<ffffffff81090830>] ? kthread+0x0/0xa0
       [<ffffffff8100c140>] ? child_rip+0x0/0x20
      Code: 00 00 eb d1 4c 8b 2d 3c 8f 97 00 4d 85 ed 74 bf 49 8b 45 00 49 83 c5 08 48 89 de 4c 89 e7 ff d0 49 8b 45 00 48 85 c0 75 eb eb a4 <0f> 0b eb fe 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00
      RIP  [<ffffffff8124e424>] blk_requeue_request+0x94/0xa0
       RSP <ffff881057eefd60>
      
      The RIP is this line:
              BUG_ON(blk_queued_rq(rq));
      
      After digging through the code, I think there may be a race between the
      request completion and the timer handler running.
      
      A timer is started for each request put on the device's queue (see
      blk_start_request->blk_add_timer).  If the request does not complete
      before the timer expires, the timer handler (blk_rq_timed_out_timer)
      will mark the request complete atomically:
      
      static inline int blk_mark_rq_complete(struct request *rq)
      {
              return test_and_set_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags);
      }
      
      and then call blk_rq_timed_out.  The latter function will call
      scsi_times_out, which will return one of BLK_EH_HANDLED,
      BLK_EH_RESET_TIMER or BLK_EH_NOT_HANDLED.  If BLK_EH_RESET_TIMER is
      returned, blk_clear_rq_complete is called, and blk_add_timer is again
      called to simply wait longer for the request to complete.
      
      Now, if the request happens to complete while this is going on, what
      happens?  Given that we know the completion handler will bail if it
      finds the REQ_ATOM_COMPLETE bit set, we need to focus on the completion
      handler running after that bit is cleared.  So, from the above
      paragraph, after the call to blk_clear_rq_complete.  If the completion
      sets REQ_ATOM_COMPLETE before the BUG_ON in blk_add_timer, we go boom
      there (I haven't seen this in the cores).  Next, if we get the
      completion before the call to list_add_tail, then the timer will
      eventually fire for an old req, which may either be freed or reallocated
      (there is evidence that this might be the case).  Finally, if the
      completion comes in *after* the addition to the timeout list, I think
      it's harmless.  The request will be removed from the timeout list,
      req_atom_complete will be set, and all will be well.
      
      This will only actually explain the coredumps *IF* the request
      structure was freed, reallocated *and* queued before the error handler
      thread had a chance to process it.  That is possible, but it may make
      sense to keep digging for another race.  I think that if this is what
      was happening, we would see other instances of this problem showing up
      as null pointer or garbage pointer dereferences, for example when the
      request structure was not re-used.  It looks like we actually do run
      into that situation in other reports.
      
      This patch moves the BUG_ON(test_bit(REQ_ATOM_COMPLETE,
      &req->atomic_flags)); from blk_add_timer to the only caller that could
      trip over it (blk_start_request).  It then inverts the calls to
      blk_clear_rq_complete and blk_add_timer in blk_rq_timed_out to address
      the race.  I've boot tested this patch, but nothing more.
      Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Acked-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c76cf3d0
    • Fenghua Yu's avatar
      x86/apic: Disable I/O APIC before shutdown of the local APIC · d8c3245c
      Fenghua Yu authored
      commit 522e6646 upstream.
      
      In reboot and crash path, when we shut down the local APIC, the I/O APIC is
      still active. This may cause issues because external interrupts
      can still come in and disturb the local APIC during shutdown process.
      
      To quiet external interrupts, disable I/O APIC before shutdown local APIC.
      Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
      Link: http://lkml.kernel.org/r/1382578212-4677-1-git-send-email-fenghua.yu@intel.com
      [ I suppose the 'issue' is a hang during shutdown. It's a fine change nevertheless. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d8c3245c
    • Ursula Braun's avatar
      qeth: avoid buffer overflow in snmp ioctl · a3e38398
      Ursula Braun authored
      commit 6fb392b1 upstream.
      
      Check user-defined length in snmp ioctl request and allow request
      only if it fits into a qeth command buffer.
      Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
      Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
      Reviewed-by: default avatarHeiko Carstens <heicars2@linux.vnet.ibm.com>
      Reported-by: default avatarNico Golde <nico@ngolde.de>
      Reported-by: default avatarFabian Yamaguchi <fabs@goesec.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a3e38398
    • Brian Norris's avatar
      mtd: m25p80: fix allocation size · 2a4c85e7
      Brian Norris authored
      commit 778d226a upstream.
      
      This patch fixes two memory errors:
      
      1. During a probe failure (in mtd_device_parse_register?) the command
         buffer would not be freed.
      
      2. The command buffer's size is determined based on the 'fast_read'
         boolean, but the assignment of fast_read is made after this
         allocation. Thus, the buffer may be allocated "too small".
      
      To fix the first, just switch to the devres version of kzalloc.
      
      To fix the second, increase MAX_CMD_SIZE unconditionally. It's not worth
      saving a byte to fiddle around with the conditions here.
      
      This problem was reported by Yuhang Wang a while back.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Reported-by: default avatarYuhang Wang <wangyuhang2014@gmail.com>
      Reviewed-by: default avatarSourav Poddar <sourav.poddar@ti.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2a4c85e7
    • Wang Haitao's avatar
      mtd: map: fixed bug in 64-bit systems · eba485ec
      Wang Haitao authored
      commit a4d62bab upstream.
      
      Hardware:
      	CPU: XLP832,the 64-bit OS
      	NOR Flash:S29GL128S 128M
      Software:
      	Kernel:2.6.32.41
      	Filesystem:JFFS2
      When writing files, errors appear:
      	Write len 182  but return retlen 180
      	Write of 182 bytes at 0x072c815c failed. returned -5, retlen 180
      	Write len 186  but return retlen 184
      	Write of 186 bytes at 0x072caff4 failed. returned -5, retlen 184
      These errors exist only in 64-bit systems,not in 32-bit systems. After analysis, we
      found that the left shift operation is wrong in map_word_load_partial. For instance:
      	unsigned char buf[3] ={0x9e,0x3a,0xea};
      	map_bankwidth(map) is 4;
      	for (i=0; i < 3; i++) {
      		int bitpos;
      		bitpos = (map_bankwidth(map)-1-i)*8;
      		orig.x[0] &= ~(0xff << bitpos);
      		orig.x[0] |= buf[i] << bitpos;
      	}
      
      The value of orig.x[0] is expected to be 0x9e3aeaff, but in this situation(64-bit
      System) we'll get the wrong value of 0xffffffff9e3aeaff due to the 64-bit sign
      extension:
      buf[i] is defined as "unsigned char" and the left-shift operation will convert it
      to the type of "signed int", so when left-shift buf[i] by 24 bits, the final result
      will get the wrong value: 0xffffffff9e3aeaff.
      
      If the left-shift bits are less than 24, then sign extension will not occur. Whereas
      the bankwidth of the nor flash we used is 4, therefore this BUG emerges.
      Signed-off-by: default avatarPang Xunlei <pang.xunlei@zte.com.cn>
      Signed-off-by: default avatarZhang Yi <zhang.yi20@zte.com.cn>
      Signed-off-by: default avatarLu Zhongjun <lu.zhongjun@zte.com.cn>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      eba485ec
    • Brian Norris's avatar
      mtd: nand: hack ONFI for non-power-of-2 dimensions · 229236a8
      Brian Norris authored
      commit 4355b70c upstream.
      
      Some bright specification writers decided to write this in the ONFI spec
      (from ONFI 3.0, Section 3.1):
      
        "The number of blocks and number of pages per block is not required to
        be a power of two. In the case where one of these values is not a
        power of two, the corresponding address shall be rounded to an
        integral number of bits such that it addresses a range up to the
        subsequent power of two value. The host shall not access upper
        addresses in a range that is shown as not supported."
      
      This breaks every assumption MTD makes about NAND block/chip-size
      dimensions -- they *must* be a power of two!
      
      And of course, an enterprising manufacturer has made use of this lovely
      freedom. Exhibit A: Micron MT29F32G08CBADAWP
      
        "- Plane size: 2 planes x 1064 blocks per plane
         - Device size: 32Gb: 2128 blockss [sic]"
      
      This quickly hits a BUG() in nand_base.c, since the extra dimensions
      overflow so we think it's a second chip (on my single-chip setup):
      
          ONFI param page 0 valid
          ONFI flash detected
          NAND device: Manufacturer ID: 0x2c, Chip ID: 0x44 (Micron MT29F32G08CBADAWP), 4256MiB, page size: 8192, OOB size: 744
          ------------[ cut here ]------------
          kernel BUG at drivers/mtd/nand/nand_base.c:203!
          Internal error: Oops - BUG: 0 [#1] SMP ARM
          [... trim ...]
          [<c02cf3e4>] (nand_select_chip+0x18/0x2c) from [<c02d25c0>] (nand_do_read_ops+0x90/0x424)
          [<c02d25c0>] (nand_do_read_ops+0x90/0x424) from [<c02d2dd8>] (nand_read+0x54/0x78)
          [<c02d2dd8>] (nand_read+0x54/0x78) from [<c02ad2c8>] (mtd_read+0x84/0xbc)
          [<c02ad2c8>] (mtd_read+0x84/0xbc) from [<c02d4b28>] (scan_read.clone.4+0x4c/0x64)
          [<c02d4b28>] (scan_read.clone.4+0x4c/0x64) from [<c02d4c88>] (search_bbt+0x148/0x290)
          [<c02d4c88>] (search_bbt+0x148/0x290) from [<c02d4ea4>] (nand_scan_bbt+0xd4/0x5c0)
          [... trim ...]
          ---[ end trace 0c9363860d865ff2 ]---
      
      So to fix this, just truncate these dimensions down to the greatest
      power-of-2 dimension that is less than or equal to the specified
      dimension.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - p->lun_count is not used]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      229236a8
    • Takashi Iwai's avatar
      ALSA: hda - Add support for CX20952 · 9712d74a
      Takashi Iwai authored
      commit 8f42d769 upstream.
      
      It's a superset of the existing CX2075x codecs, so we can reuse the
      existing parser code.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9712d74a
    • Aaron Lu's avatar
      PM / hibernate: Avoid overflow in hibernate_preallocate_memory() · 103ebb40
      Aaron Lu authored
      commit fd432b9f upstream.
      
      When system has a lot of highmem (e.g. 16GiB using a 32 bits kernel),
      the code to calculate how much memory we need to preallocate in
      normal zone may cause overflow. As Leon has analysed:
      
       It looks that during computing 'alloc' variable there is overflow:
       alloc = (3943404 - 1970542) - 1978280 = -5418 (signed)
       And this function goes to err_out.
      
      Fix this by avoiding that overflow.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=60817Reported-and-tested-by: default avatarLeon Drugi <eyak@wp.pl>
      Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      103ebb40
    • Thomas Hellstrom's avatar
      drm/ttm: Fix memory type compatibility check · d81980f4
      Thomas Hellstrom authored
      commit 59c8e663 upstream.
      
      Also check the busy placements before deciding to move a buffer object.
      Failing to do this may result in a completely unneccessary move within a
      single memory type.
      Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: default avatarJakob Bornecrantz <jakob@vmware.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d81980f4
    • Mathias Krause's avatar
      audit: use nlmsg_len() to get message payload length · f42c03d9
      Mathias Krause authored
      commit 4d8fe737 upstream.
      
      Using the nlmsg_len member of the netlink header to test if the message
      is valid is wrong as it includes the size of the netlink header itself.
      Thereby allowing to send short netlink messages that pass those checks.
      
      Use nlmsg_len() instead to test for the right message length. The result
      of nlmsg_len() is guaranteed to be non-negative as the netlink message
      already passed the checks of nlmsg_ok().
      
      Also switch to min_t() to please checkpatch.pl.
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Paris <eparis@redhat.com>
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      [bwh: Backported to 3.2: there aren't any optional fields for AUDIT_TTY_SET
       so adjust the size test similarly as for AUDIT_SET]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f42c03d9
    • Mathias Krause's avatar
      audit: fix info leak in AUDIT_GET requests · 71deebc1
      Mathias Krause authored
      commit 64fbff9a upstream.
      
      We leak 4 bytes of kernel stack in response to an AUDIT_GET request as
      we miss to initialize the mask member of status_set. Fix that.
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Paris <eparis@redhat.com>
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      71deebc1
    • Tyler Hicks's avatar
      audit: printk USER_AVC messages when audit isn't enabled · e08af767
      Tyler Hicks authored
      commit 0868a5e1 upstream.
      
      When the audit=1 kernel parameter is absent and auditd is not running,
      AUDIT_USER_AVC messages are being silently discarded.
      
      AUDIT_USER_AVC messages should be sent to userspace using printk(), as
      mentioned in the commit message of 4a4cd633 ("AUDIT: Optimise the
      audit-disabled case for discarding user messages").
      
      When audit_enabled is 0, audit_receive_msg() discards all user messages
      except for AUDIT_USER_AVC messages. However, audit_log_common_recv_msg()
      refuses to allocate an audit_buffer if audit_enabled is 0. The fix is to
      special case AUDIT_USER_AVC messages in both functions.
      
      It looks like commit 50397bd1 ("[AUDIT] clean up audit_receive_msg()")
      introduced this bug.
      Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: linux-audit@redhat.com
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e08af767
    • Herbert Xu's avatar
      crypto: s390 - Fix aes-cbc IV corruption · 898c8e6f
      Herbert Xu authored
      commit f262f0f5 upstream.
      
      The cbc-aes-s390 algorithm incorrectly places the IV in the tfm
      data structure.  As the tfm is shared between multiple threads,
      this introduces a possibility of data corruption.
      
      This patch fixes this by moving the parameter block containing
      the IV and key onto the stack (the block is 48 bytes long).
      
      The same bug exists elsewhere in the s390 crypto system and they
      will be fixed in subsequent patches.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      898c8e6f
    • Greg Edwards's avatar
      KVM: IOMMU: hva align mapping page size · da4eda14
      Greg Edwards authored
      commit 27ef63c7 upstream.
      
      When determining the page size we could use to map with the IOMMU, the
      page size should also be aligned with the hva, not just the gfn.  The
      gfn may not reflect the real alignment within the hugetlbfs file.
      
      Most of the time, this works fine.  However, if the hugetlbfs file is
      backed by non-contiguous huge pages, a multi-huge page memslot starts at
      an unaligned offset within the hugetlbfs file, and the gfn is aligned
      with respect to the huge page size, kvm_host_page_size() will return the
      huge page size and we will use that to map with the IOMMU.
      
      When we later unpin that same memslot, the IOMMU returns the unmap size
      as the huge page size, and we happily unpin that many pfns in
      monotonically increasing order, not realizing we are spanning
      non-contiguous huge pages and partially unpin the wrong huge page.
      
      Ensure the IOMMU mapping page size is aligned with the hva corresponding
      to the gfn, which does reflect the alignment within the hugetlbfs file.
      Reviewed-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarGreg Edwards <gedwards@ddn.com>
      Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
      [bwh: Backported to 3.2: s/__gfn_to_hva_memslot/gfn_to_hva_memslot/]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      da4eda14
    • James Ralston's avatar
      ahci: Add Device IDs for Intel Wildcat Point-LP · 17318fb3
      James Ralston authored
      commit 9f961a5f upstream.
      
      This patch adds the AHCI-mode SATA Device IDs for the Intel Wildcat Point-LP PCH.
      Signed-off-by: default avatarJames Ralston <james.d.ralston@intel.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      17318fb3
    • Phil Edworthy's avatar
      ASoC: ak4642: prevent un-necessary changes to SG_SL1 · ba3aaf91
      Phil Edworthy authored
      commit 7b5bfb82 upstream.
      
      If you record the sound during playback,
      the playback sound becomes silent.
      Modify so that the codec driver does not clear
      SG_SL1::DACL bit which is controlled under widget
      Signed-off-by: default avatarPhil Edworthy <phil.edworthy@renesas.com>
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ba3aaf91
    • Theodore Ts'o's avatar
      67e2113d
    • Shiva Krishna Merla's avatar
      dm mpath: fix race condition between multipath_dtr and pg_init_done · 75b23979
      Shiva Krishna Merla authored
      commit 954a73d5 upstream.
      
      Whenever multipath_dtr() is happening we must prevent queueing any
      further path activation work.  Implement this by adding a new
      'pg_init_disabled' flag to the multipath structure that denotes future
      path activation work should be skipped if it is set.  By disabling
      pg_init and then re-enabling in flush_multipath_work() we also avoid the
      potential for pg_init to be initiated while suspending an mpath device.
      
      Without this patch a race condition exists that may result in a kernel
      panic:
      
      1) If after pg_init_done() decrements pg_init_in_progress to 0, a call
         to wait_for_pg_init_completion() assumes there are no more pending path
         management commands.
      2) If pg_init_required is set by pg_init_done(), due to retryable
         mode_select errors, then process_queued_ios() will again queue the
         path activation work.
      3) If free_multipath() completes before activate_path() work is called a
         NULL pointer dereference like the following can be seen when
         accessing members of the recently destructed multipath:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000090
      RIP: 0010:[<ffffffffa003db1b>]  [<ffffffffa003db1b>] activate_path+0x1b/0x30 [dm_multipath]
      [<ffffffff81090ac0>] worker_thread+0x170/0x2a0
      [<ffffffff81096c80>] ? autoremove_wake_function+0x0/0x40
      
      [switch to disabling pg_init in flush_multipath_work & header edits by Mike Snitzer]
      Signed-off-by: default avatarShiva Krishna Merla <shivakrishna.merla@netapp.com>
      Reviewed-by: default avatarKrishnasamy Somasundaram <somasundaram.krishnasamy@netapp.com>
      Tested-by: default avatarSpeagle Andy <Andy.Speagle@netapp.com>
      Acked-by: default avatarJunichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - Bump version to 1.3.2 not 1.6.0]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      75b23979
    • Markus Pargmann's avatar
      can: c_can: Fix RX message handling, handle lost message before EOB · e8edf57c
      Markus Pargmann authored
      commit 5d0f801a upstream.
      
      If we handle end of block messages with higher priority than a lost message,
      we can run into an endless interrupt loop.
      
      This is reproducable with a am335x processor and "cansequence -r" at 1Mbit.
      As soon as we loose a packet we can't escape from an interrupt loop.
      
      This patch fixes the problem by handling lost packets before EOB packets.
      Signed-off-by: default avatarMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e8edf57c
    • Mikulas Patocka's avatar
      dm: allocate buffer for messages with small number of arguments using GFP_NOIO · 224a07b4
      Mikulas Patocka authored
      commit f36afb39 upstream.
      
      dm-mpath and dm-thin must process messages even if some device is
      suspended, so we allocate argv buffer with GFP_NOIO. These messages have
      a small fixed number of arguments.
      
      On the other hand, dm-switch needs to process bulk data using messages
      so excessive use of GFP_NOIO could cause trouble.
      
      The patch also lowers the default number of arguments from 64 to 8, so
      that there is smaller load on GFP_NOIO allocations.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      224a07b4
    • Prarit Bhargava's avatar
      powerpc/vio: use strcpy in modalias_show · f3880847
      Prarit Bhargava authored
      commit 411cabf7 upstream.
      
      Commit e82b89a6 used strcat instead of
      strcpy which can result in an overflow of newlines on the buffer.
      
      Signed-off-by: Prarit Bhargava
      Cc: benh@kernel.crashing.org
      Cc: ben@decadent.org.uk
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f3880847
    • Prarit Bhargava's avatar
      powerpc/vio: Fix modalias_show return values · 87ab8e5e
      Prarit Bhargava authored
      commit e82b89a6 upstream.
      
      modalias_show() should return an empty string on error, not -ENODEV.
      
      This causes the following false and annoying error:
      
      > find /sys/devices -name modalias -print0 | xargs -0 cat >/dev/null
      cat: /sys/devices/vio/4000/modalias: No such device
      cat: /sys/devices/vio/4001/modalias: No such device
      cat: /sys/devices/vio/4002/modalias: No such device
      cat: /sys/devices/vio/4004/modalias: No such device
      cat: /sys/devices/vio/modalias: No such device
      Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      87ab8e5e
    • Thomas Pugliese's avatar
      usb: wusbcore: change WA_SEGS_MAX to a legal value · 4a6c6bb2
      Thomas Pugliese authored
      commit f74b75e7 upstream.
      
      change WA_SEGS_MAX to a number that is legal according to the WUSB
      spec.
      Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4a6c6bb2
    • Thomas Pugliese's avatar
      usb: wusbcore: set the RPIPE wMaxPacketSize value correctly · d83ceadb
      Thomas Pugliese authored
      commit 7b6bc07a upstream.
      
      For isochronous endpoints, set the RPIPE wMaxPacketSize value using
      wOverTheAirPacketSize from the endpoint companion descriptor instead of
      wMaxPacketSize from the normal endpoint descriptor.
      Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d83ceadb
    • Russell King's avatar
      ARM: sa11x0/assabet: ensure CS2 is configured appropriately · 5275be67
      Russell King authored
      commit f3964fe1 upstream.
      
      The CS2 region contains the Assabet board configuration and status
      registers, which are 32-bit.  Unfortunately, some boot loaders do not
      configure this region correctly, leaving it setup as a 16-bit region.
      Fix this.
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5275be67
    • Takashi Iwai's avatar
      ALSA: 6fire: Fix probe of multiple cards · e9985b96
      Takashi Iwai authored
      commit 9b389a8a upstream.
      
      The probe code of snd-usb-6fire driver overrides the devices[] pointer
      wrongly without checking whether it's already occupied or not.  This
      would screw up the device disconnection later.
      
      Spotted by coverity CID 141423.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e9985b96
    • Shan Hai's avatar
      drivers/libata: Set max sector to 65535 for Slimtype DVD A DS8A9SH drive · a499dd17
      Shan Hai authored
      commit 0523f037 upstream.
      
      The "Slimtype DVD A  DS8A9SH" drive locks up with following backtrace when
      the max sector is smaller than 65535 bytes, fix it by adding a quirk to set
      the max sector to 65535 bytes.
      
      INFO: task flush-11:0:663 blocked for more than 120 seconds.
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      flush-11:0    D 00000000ffff5ceb     0   663      2 0x00000000
       ffff88026d3b1710 0000000000000046 0000000000000001 0000000000000000
       ffff88026f2530c0 ffff88026d365860 ffff88026d3b16e0 ffffffff812ffd52
       ffff88026d4fd3d0 0000000100000001 ffff88026d3b16f0 ffff88026d3b1fd8
      Call Trace:
       [<ffffffff812ffd52>] ? cfq_may_queue+0x52/0xf0
       [<ffffffff81604338>] schedule+0x18/0x30
       [<ffffffff81604392>] io_schedule+0x42/0x60
       [<ffffffff812f22bb>] get_request_wait+0xeb/0x1f0
       [<ffffffff81065660>] ? autoremove_wake_function+0x0/0x40
       [<ffffffff812eb382>] ? elv_merge+0x42/0x210
       [<ffffffff812f26ae>] __make_request+0x8e/0x4e0
       [<ffffffff812f068e>] generic_make_request+0x21e/0x5e0
       [<ffffffff812f0aad>] submit_bio+0x5d/0xd0
       [<ffffffff81141422>] submit_bh+0xf2/0x130
       [<ffffffff8114474c>] __block_write_full_page+0x1dc/0x3a0
       [<ffffffff81143f60>] ? end_buffer_async_write+0x0/0x120
       [<ffffffff811474e0>] ? blkdev_get_block+0x0/0x70
       [<ffffffff811474e0>] ? blkdev_get_block+0x0/0x70
       [<ffffffff81143f60>] ? end_buffer_async_write+0x0/0x120
       [<ffffffff811449ee>] block_write_full_page_endio+0xde/0x100
       [<ffffffff81144a20>] block_write_full_page+0x10/0x20
       [<ffffffff81148703>] blkdev_writepage+0x13/0x20
       [<ffffffff810d7525>] __writepage+0x15/0x40
       [<ffffffff810d7c0f>] write_cache_pages+0x1cf/0x3e0
       [<ffffffff810d7510>] ? __writepage+0x0/0x40
       [<ffffffff810d7e42>] generic_writepages+0x22/0x30
       [<ffffffff810d7e6f>] do_writepages+0x1f/0x40
       [<ffffffff8113ae67>] writeback_single_inode+0xe7/0x3b0
       [<ffffffff8113b574>] writeback_sb_inodes+0x184/0x280
       [<ffffffff8113bedb>] writeback_inodes_wb+0x6b/0x1a0
       [<ffffffff8113c24b>] wb_writeback+0x23b/0x2a0
       [<ffffffff8113c42d>] wb_do_writeback+0x17d/0x190
       [<ffffffff8113c48b>] bdi_writeback_task+0x4b/0xe0
       [<ffffffff810e82a0>] ? bdi_start_fn+0x0/0x100
       [<ffffffff810e8321>] bdi_start_fn+0x81/0x100
       [<ffffffff810e82a0>] ? bdi_start_fn+0x0/0x100
       [<ffffffff8106522e>] kthread+0x8e/0xa0
       [<ffffffff81039274>] ? finish_task_switch+0x54/0xc0
       [<ffffffff81003334>] kernel_thread_helper+0x4/0x10
       [<ffffffff810651a0>] ? kthread+0x0/0xa0
       [<ffffffff81003330>] ? kernel_thread_helper+0x0/0x10
      
       The above trace was triggered by
         "dd if=/dev/zero of=/dev/sr0 bs=2048 count=32768"
      Signed-off-by: default avatarShan Hai <shan.hai@windriver.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a499dd17
    • xiangliang yu's avatar
      ahci: disabled FBS prior to issuing software reset · daade495
      xiangliang yu authored
      commit 89dafa20 upstream.
      
      Tested with Marvell 88se9125, attached with one port mulitplier(5 ports)
      and one disk, we will get following boot log messages if using current
      code:
      
        ata8: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
        ata8.15: Port Multiplier 1.2, 0x1b4b:0x9715 r160, 5 ports, feat 0x1/0x1f
        ahci 0000:03:00.0: FBS is enabled
        ata8.00: hard resetting link
        ata8.00: SATA link down (SStatus 0 SControl 330)
        ata8.01: hard resetting link
        ata8.01: SATA link down (SStatus 0 SControl 330)
        ata8.02: hard resetting link
        ata8.02: SATA link down (SStatus 0 SControl 330)
        ata8.03: hard resetting link
        ata8.03: SATA link up 6.0 Gbps (SStatus 133 SControl 133)
        ata8.04: hard resetting link
        ata8.04: failed to resume link (SControl 133)
        ata8.04: failed to read SCR 0 (Emask=0x40)
        ata8.04: failed to read SCR 0 (Emask=0x40)
        ata8.04: failed to read SCR 1 (Emask=0x40)
        ata8.04: failed to read SCR 0 (Emask=0x40)
        ata8.03: native sectors (2) is smaller than sectors (976773168)
        ata8.03: ATA-8: ST3500413AS, JC4B, max UDMA/133
        ata8.03: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
        ata8.03: configured for UDMA/133
        ata8.04: failed to IDENTIFY (I/O error, err_mask=0x100)
        ata8.15: hard resetting link
        ata8.15: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
        ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
        ata8.15: PMP revalidation failed (errno=-19)
        ata8.15: hard resetting link
        ata8.15: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
        ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
        ata8.15: PMP revalidation failed (errno=-19)
        ata8.15: limiting SATA link speed to 3.0 Gbps
        ata8.15: hard resetting link
        ata8.15: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
        ata8.15: Port Multiplier vendor mismatch '0x1b4b' != '0x133'
        ata8.15: PMP revalidation failed (errno=-19)
        ata8.15: failed to recover PMP after 5 tries, giving up
        ata8.15: Port Multiplier detaching
        ata8.03: disabled
        ata8.00: disabled
        ata8: EH complete
      
      The reason is that current detection code doesn't follow AHCI spec:
      
      First,the port multiplier detection process look like this:
      
      	ahci_hardreset(link, class, deadline)
      	if (class == ATA_DEV_PMP) {
      		sata_pmp_attach(dev)	/* will enable FBS */
      		sata_pmp_init_links(ap, nr_ports);
      		ata_for_each_link(link, ap, EDGE) {
      			sata_std_hardreset(link, class, deadline);
      			if (link_is_online)	/* do soft reset */
      				ahci_softreset(link, class, deadline);
      		}
      	}
      But, according to chapter 9.3.9 in AHCI spec: Prior to issuing software
      reset, software shall clear PxCMD.ST to '0' and then clear PxFBS.EN to
      '0'.
      
      The patch test ok with kernel 3.11.1.
      
      tj: Patch white space contaminated, applied manually with trivial
          updates.
      Signed-off-by: default avatarXiangliang Yu <yuxiangl@marvell.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      daade495
    • Gwendal Grignou's avatar
      libata: Fix display of sata speed · 756d23aa
      Gwendal Grignou authored
      commit 3e85c3ec upstream.
      
      6.0 Gbps link speed was not decoded properly:
      speed was reported at 3.0 Gbps only.
      
      Tested: On a machine where libata reports 6.0 Gbps in
              /var/log/messages:
          ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
      
          Before:
          	cat /sys/class/ata_link/link1/sata_spd
          	3.0 Gbps
          After:
          	cat /sys/class/ata_link/link1/sata_spd
          	6.0 Gbps
      Signed-off-by: default avatarGwendal Grignou <gwendal@google.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      756d23aa
    • Rui li's avatar
      USB:add new zte 3g-dongle's pid to option.c · 02241fe0
      Rui li authored
      commit 0636fc50 upstream.
      Signed-off-by: default avatarRui li <li.rui27@zte.com.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      02241fe0