1. 23 Jun, 2011 40 commits
    • Alan Stern's avatar
      fix memory leak in scsi_report_lun_scan · 3c08ee48
      Alan Stern authored
      commit 75f8ee8e upstream.
      
      This patch (as1333) fixes a bug in scsi_report_lun_scan().  If a
      newly-allocated device can't be used, it should be deleted.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3c08ee48
    • Patrick McHardy's avatar
      netfilter: nf_conntrack_reasm: properly handle packets fragmented into a single fragment · 0a4f14ec
      Patrick McHardy authored
      commit 9e2dcf72 upstream.
      
      When an ICMPV6_PKT_TOOBIG message is received with a MTU below 1280,
      all further packets include a fragment header.
      
      Unlike regular defragmentation, conntrack also needs to "reassemble"
      those fragments in order to obtain a packet without the fragment
      header for connection tracking. Currently nf_conntrack_reasm checks
      whether a fragment has either IP6_MF set or an offset != 0, which
      makes it ignore those fragments.
      
      Remove the invalid check and make reassembly handle fragment queues
      containing only a single fragment.
      Reported-and-tested-by: default avatarUlrich Weber <uweber@astaro.com>
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0a4f14ec
    • Tian, Kevin's avatar
      xen mmu: fix a race window causing leave_mm BUG() · 35fd0fde
      Tian, Kevin authored
      commit 7899891c upstream.
      
      There's a race window in xen_drop_mm_ref, where remote cpu may exit
      dirty bitmap between the check on this cpu and the point where remote
      cpu handles drop request. So in drop_other_mm_ref we need check
      whether TLB state is still lazy before calling into leave_mm. This
      bug is rarely observed in earlier kernel, but exaggerated by the
      commit 831d52bc
      ("x86, mm: avoid possible bogus tlb entries by clearing prev mm_cpumask after switching mm")
      which clears bitmap after changing the TLB state. the call trace is as below:
      
      ---------------------------------
      kernel BUG at arch/x86/mm/tlb.c:61!
      invalid opcode: 0000 [#1] SMP
      last sysfs file: /sys/devices/system/xen_memory/xen_memory0/info/current_kb
      CPU 1
      Modules linked in: 8021q garp xen_netback xen_blkback blktap blkback_pagemap nbd bridge stp llc autofs4 ipmi_devintf ipmi_si ipmi_msghandler lockd sunrpc bonding ipv6 xenfs dm_multipath video output sbs sbshc parport_pc lp parport ses enclosure snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device serio_raw bnx2 snd_pcm_oss snd_mixer_oss snd_pcm snd_timer iTCO_wdt snd soundcore snd_page_alloc i2c_i801 iTCO_vendor_support i2c_core pcs pkr pata_acpi ata_generic ata_piix shpchp mptsas mptscsih mptbase [last unloaded: freq_table]
      Pid: 25581, comm: khelper Not tainted 2.6.32.36fixxen #1 Tecal RH2285
      RIP: e030:[<ffffffff8103a3cb>]  [<ffffffff8103a3cb>] leave_mm+0x15/0x46
      RSP: e02b:ffff88002805be48  EFLAGS: 00010046
      RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff88015f8e2da0
      RDX: ffff88002805be78 RSI: 0000000000000000 RDI: 0000000000000001
      RBP: ffff88002805be48 R08: ffff88009d662000 R09: dead000000200200
      R10: dead000000100100 R11: ffffffff814472b2 R12: ffff88009bfc1880
      R13: ffff880028063020 R14: 00000000000004f6 R15: 0000000000000000
      FS:  00007f62362d66e0(0000) GS:ffff880028058000(0000) knlGS:0000000000000000
      CS:  e033 DS: 0000 ES: 0000 CR0: 000000008005003b
      CR2: 0000003aabc11909 CR3: 000000009b8ca000 CR4: 0000000000002660
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000000 00
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process khelper (pid: 25581, threadinfo ffff88007691e000, task ffff88009b92db40)
      Stack:
       ffff88002805be68 ffffffff8100e4ae 0000000000000001 ffff88009d733b88
      <0> ffff88002805be98 ffffffff81087224 ffff88002805be78 ffff88002805be78
      <0> ffff88015f808360 00000000000004f6 ffff88002805bea8 ffffffff81010108
      Call Trace:
       <IRQ>
       [<ffffffff8100e4ae>] drop_other_mm_ref+0x2a/0x53
       [<ffffffff81087224>] generic_smp_call_function_single_interrupt+0xd8/0xfc
       [<ffffffff81010108>] xen_call_function_single_interrupt+0x13/0x28
       [<ffffffff810a936a>] handle_IRQ_event+0x66/0x120
       [<ffffffff810aac5b>] handle_percpu_irq+0x41/0x6e
       [<ffffffff8128c1c0>] __xen_evtchn_do_upcall+0x1ab/0x27d
       [<ffffffff8128dd11>] xen_evtchn_do_upcall+0x33/0x46
       [<ffffffff81013efe>] xen_do_hyper visor_callback+0x1e/0x30
       <EOI>
       [<ffffffff814472b2>] ? _spin_unlock_irqrestore+0x15/0x17
       [<ffffffff8100f8cf>] ? xen_restore_fl_direct_end+0x0/0x1
       [<ffffffff81113f71>] ? flush_old_exec+0x3ac/0x500
       [<ffffffff81150dc5>] ? load_elf_binary+0x0/0x17ef
       [<ffffffff81150dc5>] ? load_elf_binary+0x0/0x17ef
       [<ffffffff8115115d>] ? load_elf_binary+0x398/0x17ef
       [<ffffffff81042fcf>] ? need_resched+0x23/0x2d
       [<ffffffff811f4648>] ? process_measurement+0xc0/0xd7
       [<ffffffff81150dc5>] ? load_elf_binary+0x0/0x17ef
       [<ffffffff81113094>] ? search_binary_handler+0xc8/0x255
       [<ffffffff81114362>] ? do_execve+0x1c3/0x29e
       [<ffffffff8101155d>] ? sys_execve+0x43/0x5d
       [<ffffffff8106fc45>] ? __call_usermodehelper+0x0/0x6f
       [<ffffffff81013e28>] ? kernel_execve+0x68/0xd0
       [<ffffffff 8106fc45>] ? __call_usermodehelper+0x0/0x6f
       [<ffffffff8100f8cf>] ? xen_restore_fl_direct_end+0x0/0x1
       [<ffffffff8106fb64>] ? ____call_usermodehelper+0x113/0x11e
       [<ffffffff81013daa>] ? child_rip+0xa/0x20
       [<ffffffff8106fc45>] ? __call_usermodehelper+0x0/0x6f
       [<ffffffff81012f91>] ? int_ret_from_sys_call+0x7/0x1b
       [<ffffffff8101371d>] ? retint_restore_args+0x5/0x6
       [<ffffffff81013da0>] ? child_rip+0x0/0x20
      Code: 41 5e 41 5f c9 c3 55 48 89 e5 0f 1f 44 00 00 e8 17 ff ff ff c9 c3 55 48 89 e5 0f 1f 44 00 00 65 8b 04 25 c8 55 01 00 ff c8 75 04 <0f> 0b eb fe 65 48 8b 34 25 c0 55 01 00 48 81 c6 b8 02 00 00 e8
      RIP  [<ffffffff8103a3cb>] leave_mm+0x15/0x46
       RSP <ffff88002805be48>
      ---[ end trace ce9cee6832a9c503 ]---
      
      Tested-by: Maoxiaoyun<tinnycloud@hotmail.com>
      Signed-off-by: default avatarKevin Tian <kevin.tian@intel.com>
      [v1: Fleshed out the git description a bit]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      35fd0fde
    • Hemant Pedanekar's avatar
      PCI: Add quirk for setting valid class for TI816X Endpoint · 41524e92
      Hemant Pedanekar authored
      commit 63c44080 upstream.
      
      TI816X (common name for DM816x/C6A816x/AM389x family) devices configured
      to boot as PCIe Endpoint have class code = 0. This makes kernel PCI bus
      code to skip allocating BARs to these devices resulting into following
      type of error when trying to enable them:
      
      "Device 0000:01:00.0 not available because of resource collisions"
      
      The device cannot be operated because of the above issue.
      
      This patch adds a ID specific (TI VENDOR ID and 816X DEVICE ID based)
      'early' fixup quirk to replace class code with
      PCI_CLASS_MULTIMEDIA_VIDEO as class.
      Signed-off-by: default avatarHemant Pedanekar <hemantp@ti.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      41524e92
    • Trond Myklebust's avatar
      SUNRPC: Deal with the lack of a SYN_SENT sk->sk_state_change callback... · 62a5c721
      Trond Myklebust authored
      commit fe19a96b upstream.
      
      The TCP connection state code depends on the state_change() callback
      being called when the SYN_SENT state is set. However the networking layer
      doesn't actually call us back in that case.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      62a5c721
    • Namhyung Kim's avatar
      brd: handle on-demand devices correctly · 33a5ae1c
      Namhyung Kim authored
      commit af465668 upstream.
      
      When finding or allocating a ram disk device, brd_probe() did not take
      partition numbers into account so that it can result to a different
      device. Consider following example (I set CONFIG_BLK_DEV_RAM_COUNT=4
      for simplicity) :
      
      $ sudo modprobe brd max_part=15
      $ ls -l /dev/ram*
      brw-rw---- 1 root disk 1,  0 2011-05-25 15:41 /dev/ram0
      brw-rw---- 1 root disk 1, 16 2011-05-25 15:41 /dev/ram1
      brw-rw---- 1 root disk 1, 32 2011-05-25 15:41 /dev/ram2
      brw-rw---- 1 root disk 1, 48 2011-05-25 15:41 /dev/ram3
      $ sudo mknod /dev/ram4 b 1 64
      $ sudo dd if=/dev/zero of=/dev/ram4 bs=4k count=256
      256+0 records in
      256+0 records out
      1048576 bytes (1.0 MB) copied, 0.00215578 s, 486 MB/s
      namhyung@leonhard:linux$ ls -l /dev/ram*
      brw-rw---- 1 root disk 1,    0 2011-05-25 15:41 /dev/ram0
      brw-rw---- 1 root disk 1,   16 2011-05-25 15:41 /dev/ram1
      brw-rw---- 1 root disk 1,   32 2011-05-25 15:41 /dev/ram2
      brw-rw---- 1 root disk 1,   48 2011-05-25 15:41 /dev/ram3
      brw-r--r-- 1 root root 1,   64 2011-05-25 15:45 /dev/ram4
      brw-rw---- 1 root disk 1, 1024 2011-05-25 15:44 /dev/ram64
      
      After this patch, /dev/ram4 - instead of /dev/ram64 - was
      accessed correctly.
      
      In addition, 'range' passed to blk_register_region() should
      include all range of dev_t that RAMDISK_MAJOR can address.
      It does not need to be limited by partition numbers unless
      'rd_nr' param was specified.
      Signed-off-by: default avatarNamhyung Kim <namhyung@gmail.com>
      Cc: Laurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      33a5ae1c
    • Namhyung Kim's avatar
      brd: limit 'max_part' module param to DISK_MAX_PARTS · 15693902
      Namhyung Kim authored
      commit 315980c8 upstream.
      
      The 'max_part' parameter controls the number of maximum partition
      a brd device can have. However if a user specifies very large
      value it would exceed the limitation of device minor number and
      can cause a kernel panic (or, at least, produce invalid device
      nodes in some cases).
      
      On my desktop system, following command kills the kernel. On qemu,
      it triggers similar oops but the kernel was alive:
      
      $ sudo modprobe brd max_part=100000
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
       IP: [<ffffffff81110a9a>] sysfs_create_dir+0x2d/0xae
       PGD 7af1067 PUD 7b19067 PMD 0
       Oops: 0000 [#1] SMP
       last sysfs file:
       CPU 0
       Modules linked in: brd(+)
      
       Pid: 44, comm: insmod Tainted: G        W   2.6.39-qemu+ #158 Bochs Bochs
       RIP: 0010:[<ffffffff81110a9a>]  [<ffffffff81110a9a>] sysfs_create_dir+0x2d/0xae
       RSP: 0018:ffff880007b15d78  EFLAGS: 00000286
       RAX: ffff880007b05478 RBX: ffff880007a52760 RCX: ffff880007b15dc8
       RDX: ffff880007a4f900 RSI: ffff880007b15e48 RDI: ffff880007a52760
       RBP: ffff880007b15da8 R08: 0000000000000002 R09: 0000000000000000
       R10: ffff880007b15e48 R11: ffff880007b05478 R12: 0000000000000000
       R13: ffff880007b05478 R14: 0000000000400920 R15: 0000000000000063
       FS:  0000000002160880(0063) GS:ffff880007c00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000058 CR3: 0000000007b1c000 CR4: 00000000000006b0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000
       Process insmod (pid: 44, threadinfo ffff880007b14000, task ffff880007acb980)
       Stack:
        ffff880007b15dc8 ffff880007b05478 ffff880007b15da8 00000000fffffffe
        ffff880007a52760 ffff880007b05478 ffff880007b15de8 ffffffff81143c0a
        0000000000400920 ffff880007a52760 ffff880007b05478 0000000000000000
       Call Trace:
        [<ffffffff81143c0a>] kobject_add_internal+0xdf/0x1a0
        [<ffffffff81143da1>] kobject_add_varg+0x41/0x50
        [<ffffffff81143e6b>] kobject_add+0x64/0x66
        [<ffffffff8113bbe7>] blk_register_queue+0x5f/0xb8
        [<ffffffff81140f72>] add_disk+0xdf/0x289
        [<ffffffffa00040df>] brd_init+0xdf/0x1aa [brd]
        [<ffffffffa0004000>] ? 0xffffffffa0003fff
        [<ffffffffa0004000>] ? 0xffffffffa0003fff
        [<ffffffff8100020a>] do_one_initcall+0x7a/0x12e
        [<ffffffff8108516c>] sys_init_module+0x9c/0x1dc
        [<ffffffff812ff4bb>] system_call_fastpath+0x16/0x1b
       Code: 89 e5 41 55 41 54 53 48 89 fb 48 83 ec 18 48 85 ff 75 04 0f 0b eb fe 48 8b 47 18 49 c7 c4 70 1e 4d 81 48 85 c0 74 04 4c 8b 60 30
        8b 44 24 58 45 31 ed 0f b6 c4 85 c0 74 0d 48 8b 43 28 48 89
       RIP  [<ffffffff81110a9a>] sysfs_create_dir+0x2d/0xae
        RSP <ffff880007b15d78>
       CR2: 0000000000000058
       ---[ end trace aebb1175ce1f6739 ]---
      Signed-off-by: default avatarNamhyung Kim <namhyung@gmail.com>
      Cc: Laurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      15693902
    • Dan Williams's avatar
      atm: expose ATM device index in sysfs · 9e9c1e7d
      Dan Williams authored
      commit e7a46b4d upstream.
      
      It's currently exposed only through /proc which, besides requiring
      screen-scraping, doesn't allow userspace to distinguish between two
      identical ATM adapters with different ATM indexes.  The ATM device index
      is required when using PPPoATM on a system with multiple ATM adapters.
      Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
      Reviewed-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Tested-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9e9c1e7d
    • Milan Broz's avatar
      dm table: reject devices without request fns · a4401a63
      Milan Broz authored
      commit f4808ca9 upstream.
      
      This patch adds a check that a block device has a request function
      defined before it is used.  Otherwise, misconfiguration can cause an oops.
      
      Because we are allowing devices with zero size e.g. an offline multipath
      device as in commit 2cd54d9b
      ("dm: allow offline devices") there needs to be an additional check
      to ensure devices are initialised.  Some block devices, like a loop
      device without a backing file, exist but have no request function.
      
      Reproducer is trivial: dm-mirror on unbound loop device
      (no backing file on loop devices)
      
      dmsetup create x --table "0 8 mirror core 2 8 sync 2 /dev/loop0 0 /dev/loop1 0"
      
      and mirror resync will immediatelly cause OOps.
      
      BUG: unable to handle kernel NULL pointer dereference at   (null)
       ? generic_make_request+0x2bd/0x590
       ? kmem_cache_alloc+0xad/0x190
       submit_bio+0x53/0xe0
       ? bio_add_page+0x3b/0x50
       dispatch_io+0x1ca/0x210 [dm_mod]
       ? read_callback+0x0/0xd0 [dm_mirror]
       dm_io+0xbb/0x290 [dm_mod]
       do_mirror+0x1e0/0x748 [dm_mirror]
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Reported-by: default avatarZdenek Kabelac <zkabelac@redhat.com>
      Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a4401a63
    • Tero Kristo's avatar
      cpuidle: menu: fixed wrapping timers at 4.294 seconds · af73c7b8
      Tero Kristo authored
      commit 7467571f upstream.
      
      Cpuidle menu governor is using u32 as a temporary datatype for storing
      nanosecond values which wrap around at 4.294 seconds. This causes errors
      in predicted sleep times resulting in higher than should be C state
      selection and increased power consumption. This also breaks cpuidle
      state residency statistics.
      Signed-off-by: default avatarTero Kristo <tero.kristo@nokia.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      af73c7b8
    • Luca Tettamanti's avatar
      i8k: Avoid lahf in 64-bit code · c8b6153d
      Luca Tettamanti authored
      commit bc1f419c upstream.
      
      i8k uses lahf to read the flag register in 64-bit code; early x86-64
      CPUs, however, lack this instruction and we get an invalid opcode
      exception at runtime.
      Use pushf to load the flag register into the stack instead.
      Signed-off-by: default avatarLuca Tettamanti <kronos.it@gmail.com>
      Reported-by: default avatarJeff Rickman <jrickman@myamigos.us>
      Tested-by: default avatarJeff Rickman <jrickman@myamigos.us>
      Tested-by: default avatarHarry G McGavran Jr <w5pny@arrl.net>
      Cc: Massimo Dal Zotto <dz@debian.org>
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c8b6153d
    • Artem Bityutskiy's avatar
      UBIFS: fix a rare memory leak in ro to rw remounting path · b5914dec
      Artem Bityutskiy authored
      commit eaeee242 upstream.
      
      When re-mounting from R/O mode to R/W mode and the LEB count in the superblock
      is not up-to date, because for the underlying UBI volume became larger, we
      re-write the superblock. We allocate RAM for these purposes, but never free it.
      So this is a memory leak, although very rare one.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b5914dec
    • Tyler Hicks's avatar
      eCryptfs: Allow 2 scatterlist entries for encrypted filenames · ee4a3a82
      Tyler Hicks authored
      commit 8d08dab7 upstream.
      
      The buffers allocated while encrypting and decrypting long filenames can
      sometimes straddle two pages. In this situation, virt_to_scatterlist()
      will return -ENOMEM, causing the operation to fail and the user will get
      scary error messages in their logs:
      
      kernel: ecryptfs_write_tag_70_packet: Internal error whilst attempting
      to convert filename memory to scatterlist; expected rc = 1; got rc =
      [-12]. block_aligned_filename_size = [272]
      kernel: ecryptfs_encrypt_filename: Error attempting to generate tag 70
      packet; rc = [-12]
      kernel: ecryptfs_encrypt_and_encode_filename: Error attempting to
      encrypt filename; rc = [-12]
      kernel: ecryptfs_lookup: Error attempting to encrypt and encode
      filename; rc = [-12]
      
      The solution is to allow up to 2 scatterlist entries to be used.
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.vnet.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ee4a3a82
    • Christian Lamparter's avatar
      773b9883
    • Alan Stern's avatar
      OHCI: fix regression caused by nVidia shutdown workaround · a53267c7
      Alan Stern authored
      commit 2b7aaf50 upstream.
      
      This patch (as1463) fixes a regression caused by commit
      3df7169e (OHCI: work around for nVidia
      shutdown problem).
      
      The original problem encountered by people using NVIDIA chipsets was
      that USB devices were not turning off when the system shut down.  For
      example, the LED on an optical mouse would remain on, draining a
      laptop's battery.  The problem was caused by a bug in the chipset; an
      OHCI controller in the Reset state would continue to drive a bus reset
      signal even after system shutdown.  The workaround was to put the
      controllers into the Suspend state instead.
      
      It turns out that later NVIDIA chipsets do not suffer from this bug.
      Instead some have the opposite bug: If a system is shut down while an
      OHCI controller is in the Suspend state, USB devices remain powered!
      On other systems, shutting down with a Suspended controller causes the
      system to reboot immediately.  Thus, working around the original bug
      on some machines exposes other bugs on other machines.
      
      The best solution seems to be to limit the workaround to OHCI
      controllers with a low-numbered PCI product ID.  I don't know exactly
      at what point NVIDIA changed their chipsets; the value used here is a
      guess.  So far it was worked out okay for all the people who have
      tested it.
      
      This fixes Bugzilla #35032.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarAndre "Osku" Schmidt <andre.osku.schmidt@googlemail.com>
      Tested-by: default avatarYury Siamashka <yurand2@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a53267c7
    • Sarah Sharp's avatar
      xhci: Fix full speed bInterval encoding. · 4779c5e0
      Sarah Sharp authored
      commit b513d447 upstream.
      
      Dmitry's patch
      
      dfa49c4a USB: xhci - fix math in xhci_get_endpoint_interval()
      
      introduced a bug.  The USB 2.0 spec says that full speed isochronous endpoints'
      bInterval must be decoded as an exponent to a power of two (e.g. interval =
      2^(bInterval - 1)).  Full speed interrupt endpoints, on the other hand, don't
      use exponents, and the interval in frames is encoded straight into bInterval.
      
      Dmitry's patch was supposed to fix up the full speed isochronous to parse
      bInterval as an exponent, but instead it changed the *interrupt* endpoint
      bInterval decoding.  The isochronous endpoint encoding was the same.
      
      This caused full speed devices with interrupt endpoints (including mice, hubs,
      and USB to ethernet devices) to fail under NEC 0.96 xHCI host controllers:
      
      [  100.909818] xhci_hcd 0000:06:00.0: add ep 0x83, slot id 1, new drop flags = 0x0, new add flags = 0x99, new slot info = 0x38100000
      [  100.909821] xhci_hcd 0000:06:00.0: xhci_check_bandwidth called for udev ffff88011f0ea000
      ...
      [  100.910187] xhci_hcd 0000:06:00.0: ERROR: unexpected command completion code 0x11.
      [  100.910190] xhci_hcd 0000:06:00.0: xhci_reset_bandwidth called for udev ffff88011f0ea000
      
      When the interrupt endpoint was added and a Configure Endpoint command was
      issued to the host, the host controller would return a very odd error message
      (0x11 means "Slot Not Enabled", which isn't true because the slot was enabled).
      Probably the host controller was getting very confused with the bad encoding.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Dmitry Torokhov <dtor@vmware.com>
      Reported-by: default avatarThomas Lindroth <thomas.lindroth@gmail.com>
      Tested-by: default avatarThomas Lindroth <thomas.lindroth@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4779c5e0
    • Felipe Balbi's avatar
      usb: gadget: rndis: don't test against req->length · 24bf8073
      Felipe Balbi authored
      commit 472b9127 upstream.
      
      composite.c always sets req->length to zero
      and expects function driver's setup handlers
      to return the amount of bytes to be used
      on req->length. If we test against req->length
      w_length will always be greater than req->length
      thus making us always stall that particular
      SEND_ENCAPSULATED_COMMAND request.
      
      Tested against a Windows XP SP3.
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      24bf8073
    • Jean-Christophe PLAGNIOL-VILLARD's avatar
      usb/gadget: at91sam9g20 fix end point max packet size · fae4005c
      Jean-Christophe PLAGNIOL-VILLARD authored
      commit bf1f0a05 upstream.
      
      on 9g20 they are the same as the 9260
      Signed-off-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      fae4005c
    • Hermann Kneissel's avatar
      USB: gamin_gps: Fix for data transfer problems in native mode · f8ef28d4
      Hermann Kneissel authored
      commit b4026c45 upstream.
      
      This patch fixes a problem where data received from the gps is sometimes
      transferred incompletely to the serial port. If used in native mode now
      all data received via the bulk queue will be forwarded to the serial
      port.
      Signed-off-by: default avatarHermann Kneissel <herkne@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f8ef28d4
    • Benedek László's avatar
      USB: serial: ftdi_sio: adding support for TavIR STK500 · 15b8466d
      Benedek László authored
      commit 37909fe5 upstream.
      
      Adding support for the TavIR STK500 (id 0403:FA33)
      Atmel AVR programmer device based on FTDI FT232RL.
      Signed-off-by: default avatarBenedek László <benedekl@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      15b8466d
    • Elizabeth Jennifer Myers's avatar
      USB: moto_modem: Add USB identifier for the Motorola VE240. · e658945a
      Elizabeth Jennifer Myers authored
      commit 3938a0b3 upstream.
      
      Tested on my phone, the ttyUSB device is created and is fully
      functional.
      Signed-off-by: default avatarElizabeth Jennifer Myers <elizabeth@sporksirc.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e658945a
    • Craig Shelley's avatar
      USB: CP210x Add 4 Device IDs for AC-Services Devices · 56344ef3
      Craig Shelley authored
      commit 4eff0b40 upstream.
      
      This patch adds 4 device IDs for CP2102 based devices manufactured by
      AC-Services. See http://www.ac-services.eu for further info.
      Signed-off-by: default avatarCraig Shelley <craig@microtron.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      56344ef3
    • Namhyung Kim's avatar
      loop: handle on-demand devices correctly · e4eb3c88
      Namhyung Kim authored
      commit a1c15c59 upstream.
      
      When finding or allocating a loop device, loop_probe() did not take
      partition numbers into account so that it can result to a different
      device. Consider following example:
      
      $ sudo modprobe loop max_part=15
      $ ls -l /dev/loop*
      brw-rw---- 1 root disk 7,   0 2011-05-24 22:16 /dev/loop0
      brw-rw---- 1 root disk 7,  16 2011-05-24 22:16 /dev/loop1
      brw-rw---- 1 root disk 7,  32 2011-05-24 22:16 /dev/loop2
      brw-rw---- 1 root disk 7,  48 2011-05-24 22:16 /dev/loop3
      brw-rw---- 1 root disk 7,  64 2011-05-24 22:16 /dev/loop4
      brw-rw---- 1 root disk 7,  80 2011-05-24 22:16 /dev/loop5
      brw-rw---- 1 root disk 7,  96 2011-05-24 22:16 /dev/loop6
      brw-rw---- 1 root disk 7, 112 2011-05-24 22:16 /dev/loop7
      $ sudo mknod /dev/loop8 b 7 128
      $ sudo losetup /dev/loop8 ~/temp/disk-with-3-parts.img
      $ sudo losetup -a
      /dev/loop128: [0805]:278201 (/home/namhyung/temp/disk-with-3-parts.img)
      $ ls -l /dev/loop*
      brw-rw---- 1 root disk 7,    0 2011-05-24 22:16 /dev/loop0
      brw-rw---- 1 root disk 7,   16 2011-05-24 22:16 /dev/loop1
      brw-rw---- 1 root disk 7, 2048 2011-05-24 22:18 /dev/loop128
      brw-rw---- 1 root disk 7, 2049 2011-05-24 22:18 /dev/loop128p1
      brw-rw---- 1 root disk 7, 2050 2011-05-24 22:18 /dev/loop128p2
      brw-rw---- 1 root disk 7, 2051 2011-05-24 22:18 /dev/loop128p3
      brw-rw---- 1 root disk 7,   32 2011-05-24 22:16 /dev/loop2
      brw-rw---- 1 root disk 7,   48 2011-05-24 22:16 /dev/loop3
      brw-rw---- 1 root disk 7,   64 2011-05-24 22:16 /dev/loop4
      brw-rw---- 1 root disk 7,   80 2011-05-24 22:16 /dev/loop5
      brw-rw---- 1 root disk 7,   96 2011-05-24 22:16 /dev/loop6
      brw-rw---- 1 root disk 7,  112 2011-05-24 22:16 /dev/loop7
      brw-r--r-- 1 root root 7,  128 2011-05-24 22:17 /dev/loop8
      
      After this patch, /dev/loop8 - instead of /dev/loop128 - was
      accessed correctly.
      
      In addition, 'range' passed to blk_register_region() should
      include all range of dev_t that LOOP_MAJOR can address. It does
      not need to be limited by partition numbers unless 'max_loop'
      param was specified.
      Signed-off-by: default avatarNamhyung Kim <namhyung@gmail.com>
      Cc: Laurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e4eb3c88
    • Namhyung Kim's avatar
      loop: limit 'max_part' module param to DISK_MAX_PARTS · 2a140e31
      Namhyung Kim authored
      commit 78f4bb36 upstream.
      
      The 'max_part' parameter controls the number of maximum partition
      a loop block device can have. However if a user specifies very
      large value it would exceed the limitation of device minor number
      and can cause a kernel panic (or, at least, produce invalid
      device nodes in some cases).
      
      On my desktop system, following command kills the kernel. On qemu,
      it triggers similar oops but the kernel was alive:
      
      $ sudo modprobe loop max_part0000
       ------------[ cut here ]------------
       kernel BUG at /media/Linux_Data/project/linux/fs/sysfs/group.c:65!
       invalid opcode: 0000 [#1] SMP
       last sysfs file:
       CPU 0
       Modules linked in: loop(+)
      
       Pid: 43, comm: insmod Tainted: G        W   2.6.39-qemu+ #155 Bochs Bochs
       RIP: 0010:[<ffffffff8113ce61>]  [<ffffffff8113ce61>] internal_create_group=
      +0x2a/0x170
       RSP: 0018:ffff880007b3fde8  EFLAGS: 00000246
       RAX: 00000000ffffffef RBX: ffff880007b3d878 RCX: 00000000000007b4
       RDX: ffffffff8152da50 RSI: 0000000000000000 RDI: ffff880007b3d878
       RBP: ffff880007b3fe38 R08: ffff880007b3fde8 R09: 0000000000000000
       R10: ffff88000783b4a8 R11: ffff880007b3d878 R12: ffffffff8152da50
       R13: ffff880007b3d868 R14: 0000000000000000 R15: ffff880007b3d800
       FS:  0000000002137880(0063) GS:ffff880007c00000(0000) knlGS:00000000000000=
      00
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000422680 CR3: 0000000007b50000 CR4: 00000000000006b0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000
       Process insmod (pid: 43, threadinfo ffff880007b3e000, task ffff880007afb9c=
      0)
       Stack:
        ffff880007b3fe58 ffffffff811e66dd ffff880007b3fe58 ffffffff811e570b
        0000000000000010 ffff880007b3d800 ffff880007a7b390 ffff880007b3d868
        0000000000400920 ffff880007b3d800 ffff880007b3fe48 ffffffff8113cfc8
       Call Trace:
        [<ffffffff811e66dd>] ? device_add+0x4bc/0x5af
        [<ffffffff811e570b>] ? dev_set_name+0x3c/0x3e
        [<ffffffff8113cfc8>] sysfs_create_group+0xe/0x12
        [<ffffffff810b420e>] blk_trace_init_sysfs+0x14/0x16
        [<ffffffff8116a090>] blk_register_queue+0x47/0xf7
        [<ffffffff8116f527>] add_disk+0xdf/0x290
        [<ffffffffa00060eb>] loop_init+0xeb/0x1b8 [loop]
        [<ffffffffa0006000>] ? 0xffffffffa0005fff
        [<ffffffff8100020a>] do_one_initcall+0x7a/0x12e
        [<ffffffff81096804>] sys_init_module+0x9c/0x1e0
        [<ffffffff813329bb>] system_call_fastpath+0x16/0x1b
       Code: c3 55 48 89 e5 41 57 41 56 41 89 f6 41 55 41 54 49 89 d4 53 48 89 fb=
       48 83 ec 28 48 85 ff 74 0b 85 f6 75 0b 48 83 7f 30 00 75 14 <0f> 0b eb fe =
      48 83 7f 30 00 b9 ea ff ff ff 0f 84 18 01 00 00 49
       RIP  [<ffffffff8113ce61>] internal_create_group+0x2a/0x170
        RSP <ffff880007b3fde8>
       ---[ end trace a123eb592043acad ]---
      Signed-off-by: default avatarNamhyung Kim <namhyung@gmail.com>
      Cc: Laurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2a140e31
    • Linus Torvalds's avatar
      PCI: allow matching of prefetchable resources to non-prefetchable windows · d93bd2d1
      Linus Torvalds authored
      commit 8c8def26 upstream.
      
      I'm not entirely sure it needs to go into 32, but it's probably the right
      thing to do. Another way of explaining the patch is:
      
       - we currently pick the _first_ exactly matching bus resource entry, but
         the _last_ inexactly matching one. Normally first/last shouldn't
         matter, but bus resource entries aren't actually all created equal: in
         a transparent bus, the last resources will be the parent resources,
         which we should generally try to avoid unless we have no choice. So
         "first matching" is the thing we should always aim for.
      
       - the patch is a bit bigger than it needs to be, because I simplified the
         logic at the same time. It used to be a fairly incomprehensible
      
      	if ((res->flags & IORESOURCE_PREFETCH) && !(r->flags & IORESOURCE_PREFETCH))
      		best = r;       /* Approximating prefetchable by non-prefetchable */
      
         and technically, all the patch did was to make that complex choice be
         even more complex (it basically added a "&& !best" to say that if we
         already gound a non-prefetchable window for the prefetchable resource,
         then we won't override an earlier one with that later one: remember
         "first matching").
      
       - So instead of that complex one with three separate conditionals in one,
         I split it up a bit, and am taking advantage of the fact that we
         already handled the exact case, so if 'res->flags' has the PREFETCH
         bit, then we already know that 'r->flags' will _not_ have it. So the
         simplified code drops the redundant test, and does the new '!best' test
         separately. It also uses 'continue' as a way to ignore the bus
         resource we know doesn't work (ie a prefetchable bus resource is _not_
         acceptable for anything but an exact match), so it turns into:
      
      	/* We can't insert a non-prefetch resource inside a prefetchable parent .. */
      	if (r->flags & IORESOURCE_PREFETCH)
      		continue;
      	/* .. but we can put a prefetchable resource inside a non-prefetchable one */
      	if (!best)
      		best = r;
      
         instead. With the comments, it's now six lines instead of two, but it's
         conceptually simpler, and I _could_ have written it as two lines:
      
      	if ((res->flags & IORESOURCE_PREFETCH) && !best)
      		best = r;	/* Approximating prefetchable by non-prefetchable */
      
         but I thought that was too damn subtle.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Seth Forshee <seth.forshee@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      d93bd2d1
    • Andrew Barry's avatar
      mm/page_alloc.c: prevent unending loop in __alloc_pages_slowpath() · 864fce82
      Andrew Barry authored
      commit cfa54a0f upstream.
      
      I believe I found a problem in __alloc_pages_slowpath, which allows a
      process to get stuck endlessly looping, even when lots of memory is
      available.
      
      Running an I/O and memory intensive stress-test I see a 0-order page
      allocation with __GFP_IO and __GFP_WAIT, running on a system with very
      little free memory.  Right about the same time that the stress-test gets
      killed by the OOM-killer, the utility trying to allocate memory gets stuck
      in __alloc_pages_slowpath even though most of the systems memory was freed
      by the oom-kill of the stress-test.
      
      The utility ends up looping from the rebalance label down through the
      wait_iff_congested continiously.  Because order=0,
      __alloc_pages_direct_compact skips the call to get_page_from_freelist.
      Because all of the reclaimable memory on the system has already been
      reclaimed, __alloc_pages_direct_reclaim skips the call to
      get_page_from_freelist.  Since there is no __GFP_FS flag, the block with
      __alloc_pages_may_oom is skipped.  The loop hits the wait_iff_congested,
      then jumps back to rebalance without ever trying to
      get_page_from_freelist.  This loop repeats infinitely.
      
      The test case is pretty pathological.  Running a mix of I/O stress-tests
      that do a lot of fork() and consume all of the system memory, I can pretty
      reliably hit this on 600 nodes, in about 12 hours.  32GB/node.
      Signed-off-by: default avatarAndrew Barry <abarry@cray.com>
      Signed-off-by: default avatarMinchan Kim <minchan.kim@gmail.com>
      Reviewed-by: Rik van Riel<riel@redhat.com>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      864fce82
    • Mark Brown's avatar
    • Mark Brown's avatar
      ASoC: Ensure output PGA is enabled for line outputs in wm_hubs · 01b242ac
      Mark Brown authored
      commit d0b48af6 upstream.
      
      Also fix a left/right typo while we're at it.
      Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: default avatarLiam Girdwood <lrg@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      01b242ac
    • David Henningsson's avatar
      ALSA: HDA: Use one dmic only for Dell Studio 1558 · ce9f8da9
      David Henningsson authored
      commit e033ebfb upstream.
      
      There are no signs of a dmic at node 0x0b, so the user is left with
      an additional internal mic which does not exist. This commit removes
      that non-existing mic.
      
      BugLink: http://bugs.launchpad.net/bugs/731706Reported-by: default avatarJames Page <james.page@canonical.com>
      Signed-off-by: default avatarDavid Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ce9f8da9
    • Milton Miller's avatar
      seqlock: Don't smp_rmb in seqlock reader spin loop · ff3af587
      Milton Miller authored
      commit 5db1256a upstream.
      
      Move the smp_rmb after cpu_relax loop in read_seqlock and add
      ACCESS_ONCE to make sure the test and return are consistent.
      
      A multi-threaded core in the lab didn't like the update
      from 2.6.35 to 2.6.36, to the point it would hang during
      boot when multiple threads were active.  Bisection showed
      af5ab277 (clockevents:
      Remove the per cpu tick skew) as the culprit and it is
      supported with stack traces showing xtime_lock waits including
      tick_do_update_jiffies64 and/or update_vsyscall.
      
      Experimentation showed the combination of cpu_relax and smp_rmb
      was significantly slowing the progress of other threads sharing
      the core, and this patch is effective in avoiding the hang.
      
      A theory is the rmb is affecting the whole core while the
      cpu_relax is causing a resource rebalance flush, together they
      cause an interfernce cadance that is unbroken when the seqlock
      reader has interrupts disabled.
      
      At first I was confused why the refactor in
      3c22cd57 (kernel: optimise
      seqlock) didn't affect this patch application, but after some
      study that affected seqcount not seqlock. The new seqcount was
      not factored back into the seqlock.  I defer that the future.
      
      While the removal of the timer interrupt offset created
      contention for the xtime lock while a cpu does the
      additonal work to update the system clock, the seqlock
      implementation with the tight rmb spin loop goes back much
      further, and is just waiting for the right trigger.
      Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
      Cc: <linuxppc-dev@lists.ozlabs.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Link: http://lkml.kernel.org/r/%3Cseqlock-rmb%40mdm.bga.com%3ESigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ff3af587
    • Timo Warns's avatar
      Fix for buffer overflow in ldm_frag_add not sufficient · 8bdae892
      Timo Warns authored
      commit cae13fe4 upstream.
      
      As Ben Hutchings discovered [1], the patch for CVE-2011-1017 (buffer
      overflow in ldm_frag_add) is not sufficient.  The original patch in
      commit c340b1d6 ("fs/partitions/ldm.c: fix oops caused by corrupted
      partition table") does not consider that, for subsequent fragments,
      previously allocated memory is used.
      
      [1] http://lkml.org/lkml/2011/5/6/407Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarTimo Warns <warns@pre-sense.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8bdae892
    • David Chang's avatar
      staging: usbip: fix wrong endian conversion · 353be243
      David Chang authored
      commit cacd18a8 upstream.
      
      Fix number_of_packets wrong endian conversion in function
      correct_endian_ret_submit()
      Signed-off-by: default avatarDavid Chang <dchang@novell.com>
      Acked-by: default avatarArjan Mels <arjan.mels@gmx.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      353be243
    • Frederic Weisbecker's avatar
      rcu: Fix unpaired rcu_irq_enter() from locking selftests · 6fa3d714
      Frederic Weisbecker authored
      commit ba9f207c upstream.
      
      HARDIRQ_ENTER() maps to irq_enter() which calls rcu_irq_enter().
      But HARDIRQ_EXIT() maps to __irq_exit() which doesn't call
      rcu_irq_exit().
      
      So for every locking selftest that simulates hardirq disabled,
      we create an imbalance in the rcu extended quiescent state
      internal state.
      
      As a result, after the first missing rcu_irq_exit(), subsequent
      irqs won't exit dyntick-idle mode after leaving the interrupt
      handler.  This means that RCU won't see the affected CPU as being
      in an extended quiescent state, resulting in long grace-period
      delays (as in grace periods extending for hours).
      
      To fix this, just use __irq_enter() to simulate the hardirq
      context. This is sufficient for the locking selftests as we
      don't need to exit any extended quiescent state or perform
      any check that irqs normally do when they wake up from idle.
      
      As a side effect, this patch makes it possible to restore
      "rcu: Decrease memory-barrier usage based on semi-formal proof",
      which eventually helped finding this bug.
      Reported-and-tested-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6fa3d714
    • Roedel, Joerg's avatar
      x86, amd: Use _safe() msr access for GartTlbWlk disable code · 03710bb4
      Roedel, Joerg authored
      commit d47cc0db upstream.
      
      The workaround for Bugzilla:
      
      	https://bugzilla.kernel.org/show_bug.cgi?id=33012
      
      introduced a read and a write to the MC4 mask msr.
      
      Unfortunatly this MSR is not emulated by the KVM hypervisor
      so that the kernel will get a #GP and crashes when applying
      this workaround when running inside KVM.
      
      This issue was reported as:
      
      	https://bugzilla.kernel.org/show_bug.cgi?id=35132
      
      and is fixed with this patch. The change just let the kernel
      ignore any #GP it gets while accessing this MSR by using the
      _safe msr access methods.
      Reported-by: default avatarTörök Edwin <edwintorok@gmail.com>
      Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Maciej Rutecki <maciej.rutecki@gmail.com>
      Cc: Avi Kivity <avi@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      03710bb4
    • Boris Ostrovsky's avatar
      x86, amd: Do not enable ARAT feature on AMD processors below family 0x12 · 94073753
      Boris Ostrovsky authored
      commit e9cdd343 upstream.
      
      Commit b87cf80a added support for
      ARAT (Always Running APIC timer) on AMD processors that are not
      affected by erratum 400. This erratum is present on certain processor
      families and prevents APIC timer from waking up the CPU when it
      is in a deep C state, including C1E state.
      
      Determining whether a processor is affected by this erratum may
      have some corner cases and handling these cases is somewhat
      complicated. In the interest of simplicity we won't claim ARAT
      support on processor families below 0x12 and will go back to
      broadcasting timer when going idle.
      Signed-off-by: default avatarBoris Ostrovsky <ostr@amd64.org>
      Link: http://lkml.kernel.org/r/1306423192-19774-1-git-send-email-ostr@amd64.orgTested-by: default avatarBoris Petkov <borislav.petkov@amd.com>
      Cc: Hans Rosenfeld <Hans.Rosenfeld@amd.com>
      Cc: Andreas Herrmann <Andreas.Herrmann3@amd.com>
      Cc: Chuck Ebbert <cebbert@redhat.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      94073753
    • Samuel Thibault's avatar
      Fix Ultrastor asm snippet · 4efd0b08
      Samuel Thibault authored
      commit fad4dab5 upstream.
      
      Commit 1292500b replaced
      
      "=m" (*field) : "1" (*field)
      
      with
      
      "=m" (*field) :
      
      with comment "The following patch fixes it by using the '+' operator on
      the (*field) operand, marking it as read-write to gcc."
      '+' was actually forgotten.  This really puts it.
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Signed-off-by: default avatarJames Bottomley <jbottomley@parallels.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4efd0b08
    • Yang Ruirui's avatar
      ext4: release page cache in ext4_mb_load_buddy error path · 5252bdb1
      Yang Ruirui authored
      commit 26626f11 upstream.
      
      Add missing page_cache_release in the error path of ext4_mb_load_buddy
      Signed-off-by: default avatarYang Ruirui <ruirui.r.yang@tieto.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5252bdb1
    • Ted Ts'o's avatar
      jbd: fix fsync() tid wraparound bug · cdc57f82
      Ted Ts'o authored
      commit d9b01934 upstream.
      
      If an application program does not make any changes to the indirect
      blocks or extent tree, i_datasync_tid will not get updated.  If there
      are enough commits (i.e., 2**31) such that tid_geq()'s calculations
      wrap, and there isn't a currently active transaction at the time of
      the fdatasync() call, this can end up triggering a BUG_ON in
      fs/jbd/commit.c:
      
      	J_ASSERT(journal->j_running_transaction != NULL);
      
      It's pretty rare that this can happen, since it requires the use of
      fdatasync() plus *very* frequent and excessive use of fsync().  But
      with the right workload, it can.
      
      We fix this by replacing the use of tid_geq() with an equality test,
      since there's only one valid transaction id that is valid for us to
      start: namely, the currently running transaction (if it exists).
      
      Reported-by: Martin_Zielinski@McAfee.com
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      cdc57f82
    • Jan Kara's avatar
      jbd: Fix forever sleeping process in do_get_write_access() · 538e7bf8
      Jan Kara authored
      commit 2842bb20 upstream.
      
      In do_get_write_access() we wait on BH_Unshadow bit for buffer to get
      from shadow state. The waking code in journal_commit_transaction() has
      a bug because it does not issue a memory barrier after the buffer is moved
      from the shadow state and before wake_up_bit() is called. Thus a waitqueue
      check can happen before the buffer is actually moved from the shadow state
      and waiting process may never be woken. Fix the problem by issuing proper
      barrier.
      Reported-by: default avatarTao Ma <boyu.mt@taobao.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      538e7bf8
    • Jan Kara's avatar
      ext3: Fix fs corruption when make_indexed_dir() fails · d23b7b62
      Jan Kara authored
      commit 86c4f6d8 upstream.
      
      When make_indexed_dir() fails (e.g. because of ENOSPC) after it has allocated
      block for index tree root, we did not properly mark all changed buffers dirty.
      This lead to only some of these buffers being written out and thus effectively
      corrupting the directory.
      
      Fix the issue by marking all changed data dirty even in the error failure case.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d23b7b62