1. 23 Jun, 2011 40 commits
    • OGAWA Hirofumi's avatar
      fat: Fix corrupt inode flags when remove ATTR_SYS flag · 75013df1
      OGAWA Hirofumi authored
      commit 1adffbae upstream.
      
      We are clearly missing '~' in fat_ioctl_set_attributes().
      Reported-by: default avatarDmitry Dmitriev <dimondmm@yandex.ru>
      Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      75013df1
    • Daniel Haid's avatar
      drm/radeon/kms: fix for radeon on systems >4GB without hardware iommu · 7afcf472
      Daniel Haid authored
      commit 62fff811 upstream.
      
      On my x86_64 system with >4GB of ram and swiotlb instead of
      a hardware iommu (because I have a VIA chipset), the call
      to pci_set_dma_mask (see below) with 40bits returns an error.
      
      But it seems that the radeon driver is designed to have
      need_dma32 = true exactly if pci_set_dma_mask is called
      with 32 bits and false if it is called with 40 bits.
      
      I have read somewhere that the default are 32 bits. So if the
      call fails I suppose that need_dma32 should be set to true.
      
      And indeed the patch fixes the problem I have had before
      and which I had described here:
      http://choon.net/forum/read.php?21,106131,115940Acked-by: default avatarAlex Deucher <alexdeucher@gmail.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      7afcf472
    • Hans de Goede's avatar
      drm/i915: Add a no lvds quirk for the Asus EeeBox PC EB1007 · 6f478b78
      Hans de Goede authored
      commit 6a574b5b upstream.
      
      I found this while figuring out why gnome-shell would not run on my
      Asus EeeBox PC EB1007. As a standalone "pc" this device cleary does not have
      an internal panel, yet it claims it does. Add a quirk to fix this.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6f478b78
    • Peter Zijlstra's avatar
      lockdep: Fix lock_is_held() on recursion · eef1d4dd
      Peter Zijlstra authored
      commit f2513cde upstream.
      
      The main lock_is_held() user is lockdep_assert_held(), avoid false
      assertions in lockdep_off() sections by unconditionally reporting the
      lock is taken.
      
      [ the reason this is important is a lockdep_assert_held() in ttwu()
        which triggers a warning under lockdep_off() as in printk() which
        can trigger another wakeup and lock up due to spinlock
        recursion, as reported and heroically debugged by Arne Jansen ]
      Reported-and-tested-by: default avatarArne Jansen <lists@die-jansens.de>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/1307398759.2497.966.camel@laptopSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      eef1d4dd
    • Luciano Coelho's avatar
      nl80211: fix check for valid SSID size in scan operations · 946ea1c9
      Luciano Coelho authored
      commit 208c72f4 upstream.
      
      In both trigger_scan and sched_scan operations, we were checking for
      the SSID length before assigning the value correctly.  Since the
      memory was just kzalloc'ed, the check was always failing and SSID with
      over 32 characters were allowed to go through.
      
      This was causing a buffer overflow when copying the actual SSID to the
      proper place.
      
      This bug has been there since 2.6.29-rc4.
      Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      946ea1c9
    • Jordan_Hargrave@Dell.com's avatar
      PCI: Set PCIE maxpayload for card during hotplug insertion · 2d3b027d
      Jordan_Hargrave@Dell.com authored
      commit e522a712 upstream.
      
      The following patch sets the MaxPayload setting to match the parent
      reading when inserting a PCIE card into a hotplug slot.  On our system,
      the upstream bridge is set to 256, but when inserting a card, the card
      setting defaults to 128.  As soon as I/O is performed to the card it
      starts receiving errors since the payload size is too small.
      Reviewed-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Signed-off-by: default avatarJordan Hargrave <jordan_hargrave@dell.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2d3b027d
    • Hugh Dickins's avatar
      mm: fix ENOSPC returned by handle_mm_fault() · 263b8d5b
      Hugh Dickins authored
      commit e0dcd8a0 upstream.
      
      Al Viro observes that in the hugetlb case, handle_mm_fault() may return
      a value of the kind ENOSPC when its caller is expecting a value of the
      kind VM_FAULT_SIGBUS: fix alloc_huge_page()'s failure returns.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      263b8d5b
    • James Bottomley's avatar
      Fix oops caused by queue refcounting failure · 8354a9e0
      James Bottomley authored
      commit e73e079b upstream.
      
      In certain circumstances, we can get an oops from a torn down device.
      Most notably this is from CD roms trying to call scsi_ioctl.  The root
      cause of the problem is the fact that after scsi_remove_device() has
      been called, the queue is fully torn down.  This is actually wrong
      since the queue can be used until the sdev release function is called.
      Therefore, we add an extra reference to the queue which is released in
      sdev->release, so the queue always exists.
      Reported-by: default avatarParag Warudkar <parag.lkml@gmail.com>
      Signed-off-by: default avatarJames Bottomley <jbottomley@parallels.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8354a9e0
    • Jens Axboe's avatar
      block: export blk_{get,put}_queue() · d1e0c2ef
      Jens Axboe authored
      commit d86e0e83 upstream.
      
      We need them in SCSI to fix a bug, but currently they are not
      exported to modules. Export them.
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      d1e0c2ef
    • Namhyung Kim's avatar
      nbd: limit module parameters to a sane value · 6091e057
      Namhyung Kim authored
      commit 3b271082 upstream.
      
      The 'max_part' parameter controls the number of maximum partition
      a nbd 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 oops (or, at least, produce invalid device
      nodes in some cases).
      
      In addition, specifying large 'nbds_max' value causes same
      problem for the same reason.
      
      On my desktop, following command results to the kernel bug:
      
      $ sudo modprobe nbd max_part=100000
       kernel BUG at /media/Linux_Data/project/linux/fs/sysfs/group.c:65!
       invalid opcode: 0000 [#1] SMP
       last sysfs file: /sys/devices/virtual/block/nbd4/range
       CPU 1
       Modules linked in: nbd(+) bridge stp llc kvm_intel kvm asus_atk0110 sg sr_mod cdrom
      
       Pid: 2522, comm: modprobe Tainted: G        W   2.6.39-leonard+ #159 System manufacturer System Product Name/P5G41TD-M PRO
       RIP: 0010:[<ffffffff8115aa08>]  [<ffffffff8115aa08>] internal_create_group+0x2f/0x166
       RSP: 0018:ffff8801009f1de8  EFLAGS: 00010246
       RAX: 00000000ffffffef RBX: ffff880103920478 RCX: 00000000000a7bd3
       RDX: ffffffff81a2dbe0 RSI: 0000000000000000 RDI: ffff880103920478
       RBP: ffff8801009f1e38 R08: ffff880103920468 R09: ffff880103920478
       R10: ffff8801009f1de8 R11: ffff88011eccbb68 R12: ffffffff81a2dbe0
       R13: ffff880103920468 R14: 0000000000000000 R15: ffff880103920400
       FS:  00007f3c49de9700(0000) GS:ffff88011f800000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
       CR2: 00007f3b7fe7c000 CR3: 00000000cd58d000 CR4: 00000000000406e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
       Process modprobe (pid: 2522, threadinfo ffff8801009f0000, task ffff8801009a93a0)
       Stack:
        ffff8801009f1e58 ffffffff812e8f6e ffff8801009f1e58 ffffffff812e7a80
        ffff880000000010 ffff880103920400 ffff8801002fd0c0 ffff880103920468
        0000000000000011 ffff880103920400 ffff8801009f1e48 ffffffff8115ab6a
       Call Trace:
        [<ffffffff812e8f6e>] ? device_add+0x4f1/0x5e4
        [<ffffffff812e7a80>] ? dev_set_name+0x41/0x43
        [<ffffffff8115ab6a>] sysfs_create_group+0x13/0x15
        [<ffffffff810b857e>] blk_trace_init_sysfs+0x14/0x16
        [<ffffffff811ee58b>] blk_register_queue+0x4c/0xfd
        [<ffffffff811f3bdf>] add_disk+0xe4/0x29c
        [<ffffffffa007e2ab>] nbd_init+0x2ab/0x30d [nbd]
        [<ffffffffa007e000>] ? 0xffffffffa007dfff
        [<ffffffff8100020f>] do_one_initcall+0x7f/0x13e
        [<ffffffff8107ab0a>] sys_init_module+0xa1/0x1e3
        [<ffffffff814f3542>] system_call_fastpath+0x16/0x1b
       Code: 41 57 41 56 41 55 41 54 53 48 83 ec 28 0f 1f 44 00 00 48 89 fb 41 89 f6 49 89 d4 48 85 ff 74 0b 85 f6 75 0b 48 83
        7f 30 00 75 14 <0f> 0b eb fe b9 ea ff ff ff 48 83 7f 30 00 0f 84 09 01 00 00 49
       RIP  [<ffffffff8115aa08>] internal_create_group+0x2f/0x166
        RSP <ffff8801009f1de8>
       ---[ end trace 753285ffbf72c57c ]---
      Signed-off-by: default avatarNamhyung Kim <namhyung@gmail.com>
      Cc: Laurent Vivier <Laurent.Vivier@bull.net>
      Cc: Paul Clements <Paul.Clements@steeleye.com>
      Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6091e057
    • Artem Bityutskiy's avatar
      UBIFS: fix memory leak on error path · 8d9ba4b8
      Artem Bityutskiy authored
      commit 812eb258 upstream.
      
      UBIFS leaks memory on error path in 'ubifs_jnl_update()' in case of write
      failure because it forgets to free the 'struct ubifs_dent_node *dent' object.
      Although the object is small, the alignment can make it large - e.g., 2KiB
      if the min. I/O unit is 2KiB.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8d9ba4b8
    • Artem Bityutskiy's avatar
      UBIFS: fix shrinker object count reports · 439aa7df
      Artem Bityutskiy authored
      commit cf610bf4 upstream.
      
      Sometimes VM asks the shrinker to return amount of objects it can shrink,
      and we return the ubifs_clean_zn_cnt in that case. However, it is possible
      that this counter is negative for a short period of time, due to the way
      UBIFS TNC code updates it. And I can observe the following warnings sometimes:
      
      shrink_slab: ubifs_shrinker+0x0/0x2b7 [ubifs] negative objects to delete nr=-8541616642706119788
      
      This patch makes sure UBIFS never returns negative count of objects.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      439aa7df
    • Alan Stern's avatar
      fix duplicate removal on error path in scsi_sysfs_add_sdev · 8b75b318
      Alan Stern authored
      commit ee37e09d upstream.
      
      This patch (as1335) fixes a bug in scsi_sysfs_add_sdev().  Its callers
      always remove the device if anything goes wrong, so it should never
      remove the device.
      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>
      8b75b318
    • Alan Stern's avatar
      fix refcounting bug in scsi_get_host_dev · 6e3a4045
      Alan Stern authored
      commit d5469119 upstream.
      
      This patch (as1334) fixes a bug in scsi_get_host_dev().  It
      incorrectly calls get_device() on the new device's target.
      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>
      6e3a4045
    • 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