1. 12 Jan, 2012 18 commits
    • Moger, Babu's avatar
      SCSI: scsi_dh: check queuedata pointer before proceeding further · f09bb6a7
      Moger, Babu authored
      commit a18a920c upstream.
      
      This patch validates sdev pointer in scsi_dh_activate before proceeding further.
      
      Without this check we might see the panic as below. I have seen this
      panic multiple times..
      
      Call trace:
      
       #0 [ffff88007d647b50] machine_kexec at ffffffff81020902
       #1 [ffff88007d647ba0] crash_kexec at ffffffff810875b0
       #2 [ffff88007d647c70] oops_end at ffffffff8139c650
       #3 [ffff88007d647c90] __bad_area_nosemaphore at ffffffff8102dd15
       #4 [ffff88007d647d50] page_fault at ffffffff8139b8cf
          [exception RIP: scsi_dh_activate+0x82]
          RIP: ffffffffa0041922  RSP: ffff88007d647e00  RFLAGS: 00010046
          RAX: 0000000000000000  RBX: 0000000000000000  RCX: 00000000000093c5
          RDX: 00000000000093c5  RSI: ffffffffa02e6640  RDI: ffff88007cc88988
          RBP: 000000000000000f   R8: ffff88007d646000   R9: 0000000000000000
          R10: ffff880082293790  R11: 00000000ffffffff  R12: ffff88007cc88988
          R13: 0000000000000000  R14: 0000000000000286  R15: ffff880037b845e0
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0000
       #5 [ffff88007d647e38] run_workqueue at ffffffff81060268
       #6 [ffff88007d647e78] worker_thread at ffffffff81060386
       #7 [ffff88007d647ee8] kthread at ffffffff81064436
       #8 [ffff88007d647f48] kernel_thread at ffffffff81003fba
      Signed-off-by: default avatarBabu Moger <babu.moger@netapp.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f09bb6a7
    • Srivatsa S. Bhat's avatar
      PM / Sleep: Fix race between CPU hotplug and freezer · f71989e2
      Srivatsa S. Bhat authored
      commit 79cfbdfa upstream.
      
      The CPU hotplug notifications sent out by the _cpu_up() and _cpu_down()
      functions depend on the value of the 'tasks_frozen' argument passed to them
      (which indicates whether tasks have been frozen or not).
      (Examples for such CPU hotplug notifications: CPU_ONLINE, CPU_ONLINE_FROZEN,
      CPU_DEAD, CPU_DEAD_FROZEN).
      
      Thus, it is essential that while the callbacks for those notifications are
      running, the state of the system with respect to the tasks being frozen or
      not remains unchanged, *throughout that duration*. Hence there is a need for
      synchronizing the CPU hotplug code with the freezer subsystem.
      
      Since the freezer is involved only in the Suspend/Hibernate call paths, this
      patch hooks the CPU hotplug code to the suspend/hibernate notifiers
      PM_[SUSPEND|HIBERNATE]_PREPARE and PM_POST_[SUSPEND|HIBERNATE] to prevent
      the race between CPU hotplug and freezer, thus ensuring that CPU hotplug
      notifications will always be run with the state of the system really being
      what the notifications indicate, _throughout_ their execution time.
      Signed-off-by: default avatarSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f71989e2
    • Aurelien Jacobs's avatar
      asix: fix infinite loop in rx_fixup() · 3bb5811b
      Aurelien Jacobs authored
      commit 6c15d74d upstream.
      
      At this point if skb->len happens to be 2, the subsequant skb_pull(skb, 4)
      call won't work and the skb->len won't be decreased and won't ever reach 0,
      resulting in an infinite loop.
      
      With an ASIX 88772 under heavy load, without this patch, rx_fixup() reaches
      an infinite loop in less than a minute. With this patch applied,
      no infinite loop even after hours of heavy load.
      Signed-off-by: default avatarAurelien Jacobs <aurel@gnuage.org>
      Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3bb5811b
    • Malte Schröder's avatar
      USB: Add USB-ID for Multiplex RC serial adapter to cp210x.c · 276e8d05
      Malte Schröder authored
      commit 08e87d0d upstream.
      
      Hi, below patch adds the USB-ID of the serial adapters sold by
      Multiplex RC (www.multiplex-rc.de).
      Signed-off-by: default avatarMalte Schröder <maltesch@gmx.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      276e8d05
    • Johan Hovold's avatar
      USB: omninet: fix write_room · 0630cde2
      Johan Hovold authored
      commit 694c6301 upstream.
      
      Fix regression introduced by commit 507ca9bc ([PATCH] USB: add
      ability for usb-serial drivers to determine if their write urb is
      currently being used.) which inverted the logic in write_room so that it
      returns zero when the write urb is actually free.
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0630cde2
    • Oliver Neukum's avatar
      USB: add quirk for another camera · 94385b3e
      Oliver Neukum authored
      commit 35284b3d upstream.
      
      The Guillemot Webcam Hercules Dualpix Exchange camera
      has been reported with a second ID.
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      94385b3e
    • Huajun Li's avatar
      usb: usb-storage doesn't support dynamic id currently, the patch disables the... · 3e830aef
      Huajun Li authored
      usb: usb-storage doesn't support dynamic id currently, the patch disables the feature to fix an oops
      
      commit 1a3a026b upstream.
      
      Echo vendor and product number of a non usb-storage device to
      usb-storage driver's new_id, then plug in the device to host and you
      will find following oops msg, the root cause is usb_stor_probe1()
      refers invalid id entry if giving a dynamic id, so just disable the
      feature.
      
      [ 3105.018012] general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
      [ 3105.018062] CPU 0
      [ 3105.018075] Modules linked in: usb_storage usb_libusual bluetooth
      dm_crypt binfmt_misc snd_hda_codec_analog snd_hda_intel snd_hda_codec
      snd_hwdep hp_wmi ppdev sparse_keymap snd_pcm snd_seq_midi snd_rawmidi
      snd_seq_midi_event snd_seq snd_timer snd_seq_device psmouse snd
      serio_raw tpm_infineon soundcore i915 snd_page_alloc tpm_tis
      parport_pc tpm tpm_bios drm_kms_helper drm i2c_algo_bit video lp
      parport usbhid hid sg sr_mod sd_mod ehci_hcd uhci_hcd usbcore e1000e
      usb_common floppy
      [ 3105.018408]
      [ 3105.018419] Pid: 189, comm: khubd Tainted: G          I  3.2.0-rc7+
      #29 Hewlett-Packard HP Compaq dc7800p Convertible Minitower/0AACh
      [ 3105.018481] RIP: 0010:[<ffffffffa045830d>]  [<ffffffffa045830d>]
      usb_stor_probe1+0x2fd/0xc20 [usb_storage]
      [ 3105.018536] RSP: 0018:ffff880056a3d830  EFLAGS: 00010286
      [ 3105.018562] RAX: ffff880065f4e648 RBX: ffff88006bb28000 RCX: 0000000000000000
      [ 3105.018597] RDX: ffff88006f23c7b0 RSI: 0000000000000001 RDI: 0000000000000206
      [ 3105.018632] RBP: ffff880056a3d900 R08: 0000000000000000 R09: ffff880067365000
      [ 3105.018665] R10: 00000000000002ac R11: 0000000000000010 R12: ffff6000b41a7340
      [ 3105.018698] R13: ffff880065f4ef60 R14: ffff88006bb28b88 R15: ffff88006f23d270
      [ 3105.018733] FS:  0000000000000000(0000) GS:ffff88007a200000(0000)
      knlGS:0000000000000000
      [ 3105.018773] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [ 3105.018801] CR2: 00007fc99c8c4650 CR3: 0000000001e05000 CR4: 00000000000006f0
      [ 3105.018835] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 3105.018870] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [ 3105.018906] Process khubd (pid: 189, threadinfo ffff880056a3c000,
      task ffff88005677a400)
      [ 3105.018945] Stack:
      [ 3105.018959]  0000000000000000 0000000000000000 ffff880056a3d8d0
      0000000000000002
      [ 3105.019011]  0000000000000000 ffff880056a3d918 ffff880000000000
      0000000000000002
      [ 3105.019058]  ffff880056a3d8d0 0000000000000012 ffff880056a3d8d0
      0000000000000006
      [ 3105.019105] Call Trace:
      [ 3105.019128]  [<ffffffffa0458cd4>] storage_probe+0xa4/0xe0 [usb_storage]
      [ 3105.019173]  [<ffffffffa0097822>] usb_probe_interface+0x172/0x330 [usbcore]
      [ 3105.019211]  [<ffffffff815fda67>] driver_probe_device+0x257/0x3b0
      [ 3105.019243]  [<ffffffff815fdd43>] __device_attach+0x73/0x90
      [ 3105.019272]  [<ffffffff815fdcd0>] ? __driver_attach+0x110/0x110
      [ 3105.019303]  [<ffffffff815fb93c>] bus_for_each_drv+0x9c/0xf0
      [ 3105.019334]  [<ffffffff815fd6c7>] device_attach+0xf7/0x120
      [ 3105.019364]  [<ffffffff815fc905>] bus_probe_device+0x45/0x80
      [ 3105.019396]  [<ffffffff815f98a6>] device_add+0x876/0x990
      [ 3105.019434]  [<ffffffffa0094e42>] usb_set_configuration+0x822/0x9e0 [usbcore]
      [ 3105.019479]  [<ffffffffa00a3492>] generic_probe+0x62/0xf0 [usbcore]
      [ 3105.019518]  [<ffffffffa0097a46>] usb_probe_device+0x66/0xb0 [usbcore]
      [ 3105.019555]  [<ffffffff815fda67>] driver_probe_device+0x257/0x3b0
      [ 3105.019589]  [<ffffffff815fdd43>] __device_attach+0x73/0x90
      [ 3105.019617]  [<ffffffff815fdcd0>] ? __driver_attach+0x110/0x110
      [ 3105.019648]  [<ffffffff815fb93c>] bus_for_each_drv+0x9c/0xf0
      [ 3105.019680]  [<ffffffff815fd6c7>] device_attach+0xf7/0x120
      [ 3105.019709]  [<ffffffff815fc905>] bus_probe_device+0x45/0x80
      [ 3105.021040] usb usb6: usb auto-resume
      [ 3105.021045] usb usb6: wakeup_rh
      [ 3105.024849]  [<ffffffff815f98a6>] device_add+0x876/0x990
      [ 3105.025086]  [<ffffffffa0088987>] usb_new_device+0x1e7/0x2b0 [usbcore]
      [ 3105.025086]  [<ffffffffa008a4d7>] hub_thread+0xb27/0x1ec0 [usbcore]
      [ 3105.025086]  [<ffffffff810d5200>] ? wake_up_bit+0x50/0x50
      [ 3105.025086]  [<ffffffffa00899b0>] ? usb_remote_wakeup+0xa0/0xa0 [usbcore]
      [ 3105.025086]  [<ffffffff810d49b8>] kthread+0xd8/0xf0
      [ 3105.025086]  [<ffffffff81939884>] kernel_thread_helper+0x4/0x10
      [ 3105.025086]  [<ffffffff8192a8c0>] ? _raw_spin_unlock_irq+0x50/0x80
      [ 3105.025086]  [<ffffffff8192b1b4>] ? retint_restore_args+0x13/0x13
      [ 3105.025086]  [<ffffffff810d48e0>] ? __init_kthread_worker+0x80/0x80
      [ 3105.025086]  [<ffffffff81939880>] ? gs_change+0x13/0x13
      [ 3105.025086] Code: 00 48 83 05 cd ad 00 00 01 48 83 05 cd ad 00 00
      01 4c 8b ab 30 0c 00 00 48 8b 50 08 48 83 c0 30 48 89 45 a0 4c 89 a3
      40 0c 00 00 <41> 0f b6 44 24 10 48 89 55 a8 3c ff 0f 84 b8 04 00 00 48
      83 05
      [ 3105.025086] RIP  [<ffffffffa045830d>] usb_stor_probe1+0x2fd/0xc20
      [usb_storage]
      [ 3105.025086]  RSP <ffff880056a3d830>
      [ 3105.060037] hub 6-0:1.0: hub_resume
      [ 3105.062616] usb usb5: usb auto-resume
      [ 3105.064317] ehci_hcd 0000:00:1d.7: resume root hub
      [ 3105.094809] ---[ end trace a7919e7f17c0a727 ]---
      [ 3105.130069] hub 5-0:1.0: hub_resume
      [ 3105.132131] usb usb4: usb auto-resume
      [ 3105.132136] usb usb4: wakeup_rh
      [ 3105.180059] hub 4-0:1.0: hub_resume
      [ 3106.290052] usb usb6: suspend_rh (auto-stop)
      [ 3106.290077] usb usb4: suspend_rh (auto-stop)
      Signed-off-by: default avatarHuajun Li <huajun.li.lee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      3e830aef
    • Greg Kroah-Hartman's avatar
      USB: isight: fix kernel bug when loading firmware · e8afc51e
      Greg Kroah-Hartman authored
      commit 59bf5cf9 upstream.
      
      We were sending data on the stack when uploading firmware, which causes
      some machines fits, and is not allowed.  Fix this by using the buffer we
      already had around for this very purpose.
      Reported-by: default avatarWouter M. Koolen <wmkoolen@cwi.nl>
      Tested-by: default avatarWouter M. Koolen <wmkoolen@cwi.nl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e8afc51e
    • Julia Lawall's avatar
      drivers/usb/class/cdc-acm.c: clear dangling pointer · 151053ab
      Julia Lawall authored
      commit e7c8e860 upstream.
      
      On some failures, the country_code field of an acm structure is freed
      without freeing the acm structure itself.  Elsewhere, operations including
      memcpy and kfree are performed on the country_code field.  The patch sets
      the country_code field to NULL when it is freed, and likewise sets the
      country_code_size field to 0.
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Acked-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      151053ab
    • Alan Stern's avatar
      USB: update documentation for usbmon · 7c78b92e
      Alan Stern authored
      commit d8cae98c upstream.
      
      The documentation for usbmon is out of date; the usbfs "devices" file
      now exists in /sys/kernel/debug/usb rather than /proc/bus/usb.  This
      patch (as1505) updates the documentation accordingly, and also
      mentions that the necessary information can be found by running lsusb.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      7c78b92e
    • Jeff Mahoney's avatar
      reiserfs: Force inode evictions before umount to avoid crash · 77915669
      Jeff Mahoney authored
      commit a9e36da6 upstream.
      
      This patch fixes a crash in reiserfs_delete_xattrs during umount.
      
      When shrink_dcache_for_umount clears the dcache from
      generic_shutdown_super, delayed evictions are forced to disk. If an
      evicted inode has extended attributes associated with it, it will
      need to walk the xattr tree to locate and remove them.
      
      But since shrink_dcache_for_umount will BUG if it encounters active
      dentries, the xattr tree must be released before it's called or it will
      crash during every umount.
      
      This patch forces the evictions to occur before generic_shutdown_super
      by calling shrink_dcache_sb first. The additional evictions caused
      by the removal of each associated xattr file and dir will be automatically
      handled as they're added to the LRU list.
      
      CC: reiserfs-devel@vger.kernel.org
      Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      77915669
    • Jan Kara's avatar
      reiserfs: Fix quota mount option parsing · 12e75890
      Jan Kara authored
      commit a06d789b upstream.
      
      When jqfmt mount option is not specified on remount, we mistakenly clear
      s_jquota_fmt value stored in superblock. Fix the problem.
      
      CC: reiserfs-devel@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      12e75890
    • Aurelien Jacobs's avatar
      asix: new device id · 358e3075
      Aurelien Jacobs authored
      commit e8303a3b upstream.
      
      Adds the device id needed for the USB Ethernet Adapter delivered by
      ASUS with their Zenbook.
      Signed-off-by: default avatarAurelien Jacobs <aurel@gnuage.org>
      Acked-by: default avatarGrant Grundler <grundler@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      358e3075
    • Benjamin Herrenschmidt's avatar
      offb: Fix bug in calculating requested vram size · 0a3a07f1
      Benjamin Herrenschmidt authored
      commit c055fe07 upstream.
      
      We used to try to request 8 times more vram than needed, which would
      fail if the card has a too small BAR (observed with qemu & kvm).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0a3a07f1
    • Benjamin Herrenschmidt's avatar
      offb: Fix setting of the pseudo-palette for >8bpp · aef3cb6c
      Benjamin Herrenschmidt authored
      commit 1bb0b7d2 upstream.
      
      When using a >8bpp framebuffer, offb advertises truecolor, not directcolor,
      and doesn't touch the color map even if it has a corresponding access method
      for the real hardware.
      
      Thus it needs to set the pseudo-palette with all 3 components of the color,
      like other truecolor framebuffers, not with copies of the color index like
      a directcolor framebuffer would do.
      
      This went unnoticed for a long time because it's pretty hard to get offb
      to kick in with anything but 8bpp (old BootX under MacOS will do that and
      qemu does it).
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      aef3cb6c
    • Neil Horman's avatar
      firmware: Fix an oops on reading fw_priv->fw in sysfs loading file · 9741d973
      Neil Horman authored
      commit eea915bb upstream.
      
      This oops was reported recently:
      firmware_loading_store+0xf9/0x17b
      dev_attr_store+0x20/0x22
      sysfs_write_file+0x101/0x134
      vfs_write+0xac/0xf3
      sys_write+0x4a/0x6e
      system_call_fastpath+0x16/0x1b
      
      The complete backtrace was unfortunately not captured, but details can be found
      here:
      https://bugzilla.redhat.com/show_bug.cgi?id=769920
      
      The cause is fairly clear.
      
      Its caused by the fact that firmware_loading_store has a case 0 in its
      switch statement that reads and writes the fw_priv->fw poniter without the
      protection of the fw_lock mutex.  since there is a window between the time that
      _request_firmware sets fw_priv->fw to NULL and the time the corresponding sysfs
      file is unregistered, its possible for a user space application to race in, and
      write a zero to the loading file, causing a NULL dereference in
      firmware_loading_store.  Fix it by extending the protection of the fw_lock mutex
      to cover all of the firware_loading_store function.
      Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9741d973
    • Joe Perches's avatar
      Documentation: Update stable address · 9bcb99a7
      Joe Perches authored
      commit 2eb7f204 upstream.
      
      The Japanese/Korean/Chinese versions still need updating.
      
      Also, the stable kernel 2.6.x.y descriptions are out of date
      and should be updated as well.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9bcb99a7
    • Joe Perches's avatar
      MAINTAINERS: stable: Update address · c2cbfab5
      Joe Perches authored
      commit bc7a2f3a upstream.
      
      The old address hasn't worked since the great intrusion of August 2011.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c2cbfab5
  2. 06 Jan, 2012 10 commits
  3. 03 Jan, 2012 2 commits
  4. 21 Dec, 2011 10 commits
    • Greg Kroah-Hartman's avatar
      Linux 2.6.32.51 · c8375e7a
      Greg Kroah-Hartman authored
      c8375e7a
    • Krzysztof Hałasa's avatar
      USB: cdc-acm: add IDs for Motorola H24 HSPA USB module. · 0411b8e7
      Krzysztof Hałasa authored
      commit 6abff5dc upstream.
      
      Add USB IDs for Motorola H24 HSPA USB module.
      Signed-off-by: default avatarKrzysztof Hałasa <khalasa@piap.pl>
      Acked-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0411b8e7
    • Andrea Arcangeli's avatar
      ext4: avoid hangs in ext4_da_should_update_i_disksize() · a13bdfbb
      Andrea Arcangeli authored
      commit ea51d132 upstream.
      
      If the pte mapping in generic_perform_write() is unmapped between
      iov_iter_fault_in_readable() and iov_iter_copy_from_user_atomic(), the
      "copied" parameter to ->end_write can be zero. ext4 couldn't cope with
      it with delayed allocations enabled. This skips the i_disksize
      enlargement logic if copied is zero and no new data was appeneded to
      the inode.
      
       gdb> bt
       #0  0xffffffff811afe80 in ext4_da_should_update_i_disksize (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x1\
       08000, len=0x1000, copied=0x0, page=0xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2467
       #1  ext4_da_write_end (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x108000, len=0x1000, copied=0x0, page=0\
       xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2512
       #2  0xffffffff810d97f1 in generic_perform_write (iocb=<value optimized out>, iov=<value optimized out>, nr_segs=<value o\
       ptimized out>, pos=0x108000, ppos=0xffff88001e26be40, count=<value optimized out>, written=0x0) at mm/filemap.c:2440
       #3  generic_file_buffered_write (iocb=<value optimized out>, iov=<value optimized out>, nr_segs=<value optimized out>, p\
       os=0x108000, ppos=0xffff88001e26be40, count=<value optimized out>, written=0x0) at mm/filemap.c:2482
       #4  0xffffffff810db5d1 in __generic_file_aio_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=0x1, ppos=0\
       xffff88001e26be40) at mm/filemap.c:2600
       #5  0xffffffff810db853 in generic_file_aio_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=<value optimi\
       zed out>, pos=<value optimized out>) at mm/filemap.c:2632
       #6  0xffffffff811a71aa in ext4_file_write (iocb=0xffff88001e26bde8, iov=0xffff88001e26bec8, nr_segs=0x1, pos=0x108000) a\
       t fs/ext4/file.c:136
       #7  0xffffffff811375aa in do_sync_write (filp=0xffff88003f606a80, buf=<value optimized out>, len=<value optimized out>, \
       ppos=0xffff88001e26bf48) at fs/read_write.c:406
       #8  0xffffffff81137e56 in vfs_write (file=0xffff88003f606a80, buf=0x1ec2960 <Address 0x1ec2960 out of bounds>, count=0x4\
       000, pos=0xffff88001e26bf48) at fs/read_write.c:435
       #9  0xffffffff8113816c in sys_write (fd=<value optimized out>, buf=0x1ec2960 <Address 0x1ec2960 out of bounds>, count=0x\
       4000) at fs/read_write.c:487
       #10 <signal handler called>
       #11 0x00007f120077a390 in __brk_reservation_fn_dmi_alloc__ ()
       #12 0x0000000000000000 in ?? ()
       gdb> print offset
       $22 = 0xffffffffffffffff
       gdb> print idx
       $23 = 0xffffffff
       gdb> print inode->i_blkbits
       $24 = 0xc
       gdb> up
       #1  ext4_da_write_end (file=0xffff88003f606a80, mapping=0xffff88001d3824e0, pos=0x108000, len=0x1000, copied=0x0, page=0\
       xffffea0000d792e8, fsdata=0x0) at fs/ext4/inode.c:2512
       2512                    if (ext4_da_should_update_i_disksize(page, end)) {
       gdb> print start
       $25 = 0x0
       gdb> print end
       $26 = 0xffffffffffffffff
       gdb> print pos
       $27 = 0x108000
       gdb> print new_i_size
       $28 = 0x108000
       gdb> print ((struct ext4_inode_info *)((char *)inode-((int)(&((struct ext4_inode_info *)0)->vfs_inode))))->i_disksize
       $29 = 0xd9000
       gdb> down
       2467            for (i = 0; i < idx; i++)
       gdb> print i
       $30 = 0xd44acbee
      
      This is 100% reproducible with some autonuma development code tuned in
      a very aggressive manner (not normal way even for knumad) which does
      "exotic" changes to the ptes. It wouldn't normally trigger but I don't
      see why it can't happen normally if the page is added to swap cache in
      between the two faults leading to "copied" being zero (which then
      hangs in ext4). So it should be fixed. Especially possible with lumpy
      reclaim (albeit disabled if compaction is enabled) as that would
      ignore the young bits in the ptes.
      Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a13bdfbb
    • Robert Richter's avatar
      oprofile, x86: Fix crash when unloading module (timer mode) · 1c43963a
      Robert Richter authored
      Based on 97f7f818 oprofile, x86: Fix crash when unloading module (nmi timer
      mode) upstream.
      
      Fix for stable kernels v2.6.28.y to v2.6.34.y. This patch is for .32.
      
      Oprofile crashs while unlaoding modules and if in timer mode. Timer
      mode is the fallback if the architectural initialization fails. The
      pointer variable model is then used uninitialzied during exit causing
      a NULL pointer dereference.
      
      It can be triggered with kernel parameters oprofile.timer=1 nolapic
      used. Happens esp. in virtual machine environments.
      
      oprofile: using timer interrupt.
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
      IP: [<ffffffffa000251f>] op_nmi_exit+0x3d/0x4a [oprofile]
      PGD 42ac5e067 PUD 42ac5d067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      last sysfs file: /sys/module/oprofile/refcnt
      CPU 0
      Modules linked in: oprofile(-)
      Pid: 2245, comm: modprobe Not tainted 2.6.32.21-oprofile-x86_64-debug-00038-gf4db115e #69 Anaheim
      RIP: 0010:[<ffffffffa000251f>]  [<ffffffffa000251f>] op_nmi_exit+0x3d/0x4a [oprofile]
      RSP: 0018:ffff88042d4f9ec8  EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffffffffa0005590 RCX: ffff88042d4f9ea8
      RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
      RBP: ffff88042d4f9ec8 R08: ffff88042d4f9ee8 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000080
      R13: 00000000fffffff5 R14: 0000000000000001 R15: 00000000006101e0
      FS:  00007fef6ac9c700(0000) GS:ffff880028200000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      CR2: 0000000000000028 CR3: 000000042ac60000 CR4: 00000000000006f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process modprobe (pid: 2245, threadinfo ffff88042d4f8000, task ffff88042cd66040)
      Stack:
       ffff88042d4f9ed8 ffffffffa0002096 ffff88042d4f9ee8 ffffffffa0003bbb
      <0> ffff88042d4f9f78 ffffffff810748ad 656c69666f72706f 00007fff77a07800
      <0> ffff88042d4f9f28 ffffffff81068414 000000000060f180 0000000000000000
      Call Trace:
       [<ffffffffa0002096>] oprofile_arch_exit+0xe/0x10 [oprofile]
       [<ffffffffa0003bbb>] oprofile_exit+0x13/0x15 [oprofile]
       [<ffffffff810748ad>] sys_delete_module+0x1cd/0x244
       [<ffffffff81068414>] ? trace_hardirqs_on_caller+0x114/0x13f
       [<ffffffff8143ad47>] ? trace_hardirqs_on_thunk+0x3a/0x3f
       [<ffffffff8100b13b>] system_call_fastpath+0x16/0x1b
      Code: 48 c7 c7 90 4e 00 a0 e8 e7 15 22 e1 48 c7 c7 e0 4e 00 a0 e8 bd 18 22 e1 48 c7 c7 70 4e 00 a0 e8 94 4e 41 e1 48 8b 05 d1 39 00 00 <48> 8b 40 28 48 85 c0 74 02 ff d0 c9 c3 55 48 89 e5 e8 cb 88 00
      RIP  [<ffffffffa000251f>] op_nmi_exit+0x3d/0x4a [oprofile]
       RSP <ffff88042d4f9ec8>
      CR2: 0000000000000028
      ---[ end trace 18b12420ceb19193 ]---
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1c43963a
    • Robert Richter's avatar
      oprofile, x86: Fix nmi-unsafe callgraph support · 2d8df13b
      Robert Richter authored
      commit a0e3e702 upstream.
      
      Backport for stable kernel v2.6.32.y to v2.6.36.y.
      
      Current oprofile's x86 callgraph support may trigger page faults
      throwing the BUG_ON(in_nmi()) message below. This patch fixes this by
      using the same nmi-safe copy-from-user code as in perf.
      
      ------------[ cut here ]------------
      kernel BUG at .../arch/x86/kernel/traps.c:436!
      invalid opcode: 0000 [#1] SMP
      last sysfs file: /sys/devices/pci0000:00/0000:00:0a.0/0000:07:00.0/0000:08:04.0/net/eth0/broadcast
      CPU 5
      Modules linked in:
      
      Pid: 8611, comm: opcontrol Not tainted 2.6.39-00007-gfe47ae7f #1 Advanced Micro Device Anaheim/Anaheim
      RIP: 0010:[<ffffffff813e8e35>]  [<ffffffff813e8e35>] do_nmi+0x22/0x1ee
      RSP: 0000:ffff88042fd47f28  EFLAGS: 00010002
      RAX: ffff88042c0a7fd8 RBX: 0000000000000001 RCX: 00000000c0000101
      RDX: 00000000ffff8804 RSI: ffffffffffffffff RDI: ffff88042fd47f58
      RBP: ffff88042fd47f48 R08: 0000000000000004 R09: 0000000000001484
      R10: 0000000000000001 R11: 0000000000000000 R12: ffff88042fd47f58
      R13: 0000000000000000 R14: ffff88042fd47d98 R15: 0000000000000020
      FS:  00007fca25e56700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000074 CR3: 000000042d28b000 CR4: 00000000000006e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process opcontrol (pid: 8611, threadinfo ffff88042c0a6000, task ffff88042c532310)
      Stack:
       0000000000000000 0000000000000001 ffff88042c0a7fd8 0000000000000000
       ffff88042fd47de8 ffffffff813e897a 0000000000000020 ffff88042fd47d98
       0000000000000000 ffff88042c0a7fd8 ffff88042fd47de8 0000000000000074
      Call Trace:
       <NMI>
       [<ffffffff813e897a>] nmi+0x1a/0x20
       [<ffffffff813f08ab>] ? bad_to_user+0x25/0x771
       <<EOE>>
      Code: ff 59 5b 41 5c 41 5d c9 c3 55 65 48 8b 04 25 88 b5 00 00 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 f6 80 47 e0 ff ff 04 74 04 <0f> 0b eb fe 81 80 44 e0 ff ff 00 00 01 04 65 ff 04 25 c4 0f 01
      RIP  [<ffffffff813e8e35>] do_nmi+0x22/0x1ee
       RSP <ffff88042fd47f28>
      ---[ end trace ed6752185092104b ]---
      Kernel panic - not syncing: Fatal exception in interrupt
      Pid: 8611, comm: opcontrol Tainted: G      D     2.6.39-00007-gfe47ae7f #1
      Call Trace:
       <NMI>  [<ffffffff813e5e0a>] panic+0x8c/0x188
       [<ffffffff813e915c>] oops_end+0x81/0x8e
       [<ffffffff8100403d>] die+0x55/0x5e
       [<ffffffff813e8c45>] do_trap+0x11c/0x12b
       [<ffffffff810023c8>] do_invalid_op+0x91/0x9a
       [<ffffffff813e8e35>] ? do_nmi+0x22/0x1ee
       [<ffffffff8131e6fa>] ? oprofile_add_sample+0x83/0x95
       [<ffffffff81321670>] ? op_amd_check_ctrs+0x4f/0x2cf
       [<ffffffff813ee4d5>] invalid_op+0x15/0x20
       [<ffffffff813e8e35>] ? do_nmi+0x22/0x1ee
       [<ffffffff813e8e7a>] ? do_nmi+0x67/0x1ee
       [<ffffffff813e897a>] nmi+0x1a/0x20
       [<ffffffff813f08ab>] ? bad_to_user+0x25/0x771
       <<EOE>>
      
      Cc: John Lumby <johnlumby@hotmail.com>
      Cc: Maynard Johnson <maynardj@us.ibm.com>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2d8df13b
    • Xiao Guangrong's avatar
      export __get_user_pages_fast() function · 1872856a
      Xiao Guangrong authored
      commit 45888a0c upstream.
      
      Backport for stable kernel v2.6.32.y to v2.6.36.y.
      
      Needed for next patch:
      
       oprofile, x86: Fix nmi-unsafe callgraph support
      
      This function is used by KVM to pin process's page in the atomic context.
      
      Define the 'weak' function to avoid other architecture not support it
      Acked-by: default avatarNick Piggin <npiggin@suse.de>
      Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1872856a
    • Phillip Lougher's avatar
      hfs: fix hfs_find_init() sb->ext_tree NULL ptr oops · 34456bfa
      Phillip Lougher authored
      commit 434a964d upstream.
      
      Clement Lecigne reports a filesystem which causes a kernel oops in
      hfs_find_init() trying to dereference sb->ext_tree which is NULL.
      
      This proves to be because the filesystem has a corrupted MDB extent
      record, where the extents file does not fit into the first three extents
      in the file record (the first blocks).
      
      In hfs_get_block() when looking up the blocks for the extent file
      (HFS_EXT_CNID), it fails the first blocks special case, and falls
      through to the extent code (which ultimately calls hfs_find_init())
      which is in the process of being initialised.
      
      Hfs avoids this scenario by always having the extents b-tree fitting
      into the first blocks (the extents B-tree can't have overflow extents).
      
      The fix is to check at mount time that the B-tree fits into first
      blocks, i.e.  fail if HFS_I(inode)->alloc_blocks >=
      HFS_I(inode)->first_blocks
      
      Note, the existing commit 47f365eb ("hfs: fix oops on mount with
      corrupted btree extent records") becomes subsumed into this as a special
      case, but only for the extents B-tree (HFS_EXT_CNID), it is perfectly
      acceptable for the catalog B-Tree file to grow beyond three extents,
      with the remaining extent descriptors in the extents overfow.
      
      This fixes CVE-2011-2203
      Reported-by: default avatarClement LECIGNE <clement.lecigne@netasq.com>
      Signed-off-by: default avatarPhillip Lougher <plougher@redhat.com>
      Cc: Jeff Mahoney <jeffm@suse.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Moritz Mühlenhoff <jmm@inutil.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      34456bfa
    • Linus Torvalds's avatar
      Make TASKSTATS require root access · 6824291b
      Linus Torvalds authored
      commit 1a51410a upstream.
      
      Ok, this isn't optimal, since it means that 'iotop' needs admin
      capabilities, and we may have to work on this some more.  But at the
      same time it is very much not acceptable to let anybody just read
      anybody elses IO statistics quite at this level.
      
      Use of the GENL_ADMIN_PERM suggested by Johannes Berg as an alternative
      to checking the capabilities by hand.
      Reported-by: default avatarVasiliy Kulikov <segoon@openwall.com>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Acked-by: default avatarBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Moritz Mühlenhoff <jmm@inutil.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6824291b
    • Eryu Guan's avatar
      jbd/jbd2: validate sb->s_first in journal_get_superblock() · 90384625
      Eryu Guan authored
      commit 8762202d upstream.
      
      I hit a J_ASSERT(blocknr != 0) failure in cleanup_journal_tail() when
      mounting a fsfuzzed ext3 image. It turns out that the corrupted ext3
      image has s_first = 0 in journal superblock, and the 0 is passed to
      journal->j_head in journal_reset(), then to blocknr in
      cleanup_journal_tail(), in the end the J_ASSERT failed.
      
      So validate s_first after reading journal superblock from disk in
      journal_get_superblock() to ensure s_first is valid.
      
      The following script could reproduce it:
      
      fstype=ext3
      blocksize=1024
      img=$fstype.img
      offset=0
      found=0
      magic="c0 3b 39 98"
      
      dd if=/dev/zero of=$img bs=1M count=8
      mkfs -t $fstype -b $blocksize -F $img
      filesize=`stat -c %s $img`
      while [ $offset -lt $filesize ]
      do
              if od -j $offset -N 4 -t x1 $img | grep -i "$magic";then
                      echo "Found journal: $offset"
                      found=1
                      break
              fi
              offset=`echo "$offset+$blocksize" | bc`
      done
      
      if [ $found -ne 1 ];then
              echo "Magic \"$magic\" not found"
              exit 1
      fi
      
      dd if=/dev/zero of=$img seek=$(($offset+23)) conv=notrunc bs=1 count=1
      
      mkdir -p ./mnt
      mount -o loop $img ./mnt
      
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: default avatarEryu Guan <guaneryu@gmail.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: Moritz Mühlenhoff <jmm@inutil.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      90384625
    • Linus Torvalds's avatar
      linux/log2.h: Fix rounddown_pow_of_two(1) · 2b8efc69
      Linus Torvalds authored
      commit 13c07b02 upstream.
      
      Exactly like roundup_pow_of_two(1), the rounddown version was buggy for
      the case of a compile-time constant '1' argument.  Probably because it
      originated from the same code, sharing history with the roundup version
      from before the bugfix (for that one, see commit 1a06a52e: "Fix
      roundup_pow_of_two(1)").
      
      However, unlike the roundup version, the fix for rounddown is to just
      remove the broken special case entirely.  It's simply not needed - the
      generic code
      
          1UL << ilog2(n)
      
      does the right thing for the constant '1' argment too.  The only reason
      roundup needed that special case was because rounding up does so by
      subtracting one from the argument (and then adding one to the result)
      causing the obvious problems with "ilog2(0)".
      
      But rounddown doesn't do any of that, since ilog2() naturally truncates
      (ie "rounds down") to the right rounded down value.  And without the
      ilog2(0) case, there's no reason for the special case that had the wrong
      value.
      
      tl;dr: rounddown_pow_of_two(1) should be 1, not 0.
      Acked-by: default avatarDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2b8efc69