1. 01 Mar, 2012 5 commits
  2. 20 Feb, 2012 17 commits
  3. 13 Feb, 2012 18 commits
    • Greg Kroah-Hartman's avatar
      Linux 3.0.21 · 1d05f993
      Greg Kroah-Hartman authored
      1d05f993
    • Eric Dumazet's avatar
      net: fix NULL dereferences in check_peer_redir() · 8a533666
      Eric Dumazet authored
      [ Upstream commit d3aaeb38, along
        with dependent backports of commits:
           69cce1d1
           9de79c12
           218fa90f
           580da35a
           f7e57044
           e049f288 ]
      
      Gergely Kalman reported crashes in check_peer_redir().
      
      It appears commit f39925db (ipv4: Cache learned redirect
      information in inetpeer.) added a race, leading to possible NULL ptr
      dereference.
      
      Since we can now change dst neighbour, we should make sure a reader can
      safely use a neighbour.
      
      Add RCU protection to dst neighbour, and make sure check_peer_redir()
      can be called safely by different cpus in parallel.
      
      As neighbours are already freed after one RCU grace period, this patch
      should not add typical RCU penalty (cache cold effects)
      
      Many thanks to Gergely for providing a pretty report pointing to the
      bug.
      Reported-by: default avatarGergely Kalman <synapse@hippy.csoma.elte.hu>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a533666
    • Andreas Herrmann's avatar
      powernow-k8: Fix indexing issue · 323a4793
      Andreas Herrmann authored
      commit a8eb2848 upstream.
      
      The driver uses the pstate number from the status register as index in
      its table of ACPI pstates (powernow_table). This is wrong as this is
      not a 1-to-1 mapping.
      
      For example we can have _PSS information to just utilize Pstate 0 and
      Pstate 4, ie.
      
        powernow-k8: Core Performance Boosting: on.
        powernow-k8:    0 : pstate 0 (2200 MHz)
        powernow-k8:    1 : pstate 4 (1400 MHz)
      
      In this example the driver's powernow_table has just 2 entries. Using
      the pstate number (4) as index into this table is just plain wrong.
      Signed-off-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
      Signed-off-by: default avatarDave Jones <davej@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      323a4793
    • Andreas Herrmann's avatar
      powernow-k8: Avoid Pstate MSR accesses on systems supporting CPB · 2d8a3a20
      Andreas Herrmann authored
      commit 201bf0f1 upstream.
      
      Due to CPB we can't directly map SW Pstates to Pstate MSRs. Get rid of
      the paranoia check. (assuming that the ACPI Pstate information is
      correct.)
      Signed-off-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
      Signed-off-by: default avatarDave Jones <davej@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d8a3a20
    • Axel Lin's avatar
    • Rui li's avatar
      USB: add new zte 3g-dongle's pid to option.c · 27939daf
      Rui li authored
      commit 1608ea5f upstream.
      
      As ZTE have and will use more pid for new products this year,
      so we need to add some new zte 3g-dongle's pid on option.c ,
      and delete one pid 0x0154 because it use for mass-storage port.
      Signed-off-by: default avatarRui li <li.rui27@zte.com.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27939daf
    • Milan Kocian's avatar
      71f1a6a8
    • Jayachandran C's avatar
      usb: Skip PCI USB quirk handling for Netlogic XLP · 20ef4883
      Jayachandran C authored
      commit e4436a7c upstream.
      
      The Netlogic XLP SoC's on-chip USB controller appears as a PCI
      USB device, but does not need the EHCI/OHCI handoff done in
      usb/host/pci-quirks.c.
      
      The pci-quirks.c is enabled for all vendors and devices, and is
      enabled if USB and PCI are configured.
      
      If we do not skip the qurik handling on XLP, the readb() call in
      ehci_bios_handoff() will cause a crash since byte access is not
      supported for EHCI registers in XLP.
      Signed-off-by: default avatarJayachandran C <jayachandranc@netlogicmicro.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      20ef4883
    • Timo Juhani Lindfors's avatar
      usb: gadget: zero: fix bug in loopback autoresume handling · d6adb709
      Timo Juhani Lindfors authored
      commit 683da59d upstream.
      
      ab943a2e (USB: gadget: gadget zero uses new suspend/resume hooks)
      introduced a copy-paste error where f_loopback.c writes to a variable
      declared in f_sourcesink.c. This prevents one from creating gadgets
      that only have a loopback function.
      Signed-off-by: default avatarTimo Juhani Lindfors <timo.lindfors@iki.fi>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6adb709
    • Larry Finger's avatar
      staging: r8712u: Add new Sitecom UsB ID · fc228697
      Larry Finger authored
      commit 1793bf1d upstream.
      
      Add USB ID for SITECOM WLA-1000 V1 001 WLAN
      Reported-and-tested-by: default avatarRoland Gruber <post@rolandgruber.de>
      Reported-and-tested-by: default avatarDario Lucia <dario.lucia@gmail.com>
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc228697
    • Pekka Paalanen's avatar
      Staging: asus_oled: fix NULL-ptr crash on unloading · 946972e6
      Pekka Paalanen authored
      commit 3589e745 upstream.
      
      Asus_oled triggers the following bug on module unloading:
      
       usbcore: deregistering interface driver asus-oled
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
       IP: [<ffffffff8111292b>] sysfs_delete_link+0x30/0x66
      
       Call Trace:
        [<ffffffff81225373>] device_remove_class_symlinks+0x6b/0x70
        [<ffffffff812256a8>] device_del+0x9f/0x1ab
        [<ffffffff812257c5>] device_unregister+0x11/0x1e
        [<ffffffffa000cb82>] asus_oled_disconnect+0x4f/0x9e [asus_oled]
        [<ffffffff81277430>] usb_unbind_interface+0x54/0x103
        [<ffffffff812276c4>] __device_release_driver+0xa2/0xeb
        [<ffffffff81227794>] driver_detach+0x87/0xad
        [<ffffffff812269e9>] bus_remove_driver+0x91/0xc1
        [<ffffffff81227fb4>] driver_unregister+0x66/0x6e
        [<ffffffff812771ed>] usb_deregister+0xbb/0xc4
        [<ffffffffa000ce87>] asus_oled_exit+0x2f/0x31 [asus_oled]
        [<ffffffff81068365>] sys_delete_module+0x1b8/0x21b
        [<ffffffff810ae3de>] ? do_munmap+0x2ef/0x313
        [<ffffffff813699bb>] system_call_fastpath+0x16/0x1b
      
      This is due to an incorrect destruction sequence in asus_oled_exit().
      
      Fix the order, fixes the bug. Tested on an Asus G50V laptop only.
      
      Cc: Jakub Schmidtke <sjakub@gmail.com>
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      946972e6
    • Pekka Paalanen's avatar
      Staging: asus_oled: fix image processing · 3f64466c
      Pekka Paalanen authored
      commit 635032cb upstream.
      
      Programming an image was broken, because odev->buf_offs was not advanced
      for val == 0 in append_values(). This regression was introduced in:
      
       commit 1ff12a4a
       Author: Kevin A. Granade <kevin.granade@gmail.com>
       Date:   Sat Sep 5 01:03:39 2009 -0500
      
           Staging: asus_oled: Cleaned up checkpatch issues.
      
      Fix the image processing by special-casing val == 0.
      
      I have tested this change on an Asus G50V laptop only.
      
      Cc: Jakub Schmidtke <sjakub@gmail.com>
      Cc: Kevin A. Granade <kevin.granade@gmail.com>
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f64466c
    • Roland Dreier's avatar
      target: Correct sense key for INVALID FIELD IN {PARAMETER LIST,CDB} · 967a6f42
      Roland Dreier authored
      commit 9fbc8909 upstream.
      
      According to SPC-4, the sense key for commands that are failed with
      INVALID FIELD IN PARAMETER LIST and INVALID FIELD IN CDB should be
      ILLEGAL REQUEST (5h) rather than ABORTED COMMAND (Bh).  Without this
      patch, a tcm_loop LUN incorrectly gives:
      
          # sg_raw -r 1 -v /dev/sda 3 1 0 0 ff 0
          Sense Information:
           Fixed format, current;  Sense key: Aborted Command
           Additional sense: Invalid field in cdb
           Raw sense data (in hex):
                  70 00 0b 00 00 00 00 0a  00 00 00 00 24 00 00 00
                  00 00
      
      While a real SCSI disk gives:
      
          Sense Information:
           Fixed format, current;  Sense key: Illegal Request
           Additional sense: Invalid field in cdb
           Raw sense data (in hex):
                  70 00 05 00 00 00 00 18  00 00 00 00 24 00 00 00
                  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
      
      with the main point being that the real disk gives a sense key of
      ILLEGAL REQUEST (5h).
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      967a6f42
    • Marco Sanvido's avatar
      target: Allow PERSISTENT RESERVE IN for non-reservation holder · b8a8c4aa
      Marco Sanvido authored
      commit 6816966a upstream.
      
      Initiators that aren't the active reservation holder should be able to
      do a PERSISTENT RESERVE IN command in all cases, so add it to the list
      of allowed CDBs in core_scsi3_pr_seq_non_holder().
      Signed-off-by: default avatarMarco Sanvido <marco@purestorage.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b8a8c4aa
    • Marco Sanvido's avatar
      target: Use correct preempted registration sense code · b96473a2
      Marco Sanvido authored
      commit 9e08e34e upstream.
      
      The comments quote the right parts of the spec:
      
         * d) Establish a unit attention condition for the
         *    initiator port associated with every I_T nexus
         *    that lost its registration other than the I_T
         *    nexus on which the PERSISTENT RESERVE OUT command
         *    was received, with the additional sense code set
         *    to REGISTRATIONS PREEMPTED.
      
      and
      
         * e) Establish a unit attention condition for the initiator
         *    port associated with every I_T nexus that lost its
         *    persistent reservation and/or registration, with the
         *    additional sense code set to REGISTRATIONS PREEMPTED;
      
      but the actual code accidentally uses ASCQ_2AH_RESERVATIONS_PREEMPTED
      instead of ASCQ_2AH_REGISTRATIONS_PREEMPTED.  Fix this.
      Signed-off-by: default avatarMarco Sanvido <marco@purestorage.com>
      Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b96473a2
    • Hugh Dickins's avatar
      mm: fix UP THP spin_is_locked BUGs · 91b08ca0
      Hugh Dickins authored
      commit b9980cdc upstream.
      
      Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y
      CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false,
      and so triggers some BUGs in Transparent HugePage codepaths.
      
      asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x);
      but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE,
      VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      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@linuxfoundation.org>
      91b08ca0
    • Mel Gorman's avatar
      mm: compaction: check for overlapping nodes during isolation for migration · b9134812
      Mel Gorman authored
      commit dc908600 upstream.
      
      When isolating pages for migration, migration starts at the start of a
      zone while the free scanner starts at the end of the zone.  Migration
      avoids entering a new zone by never going beyond the free scanned.
      
      Unfortunately, in very rare cases nodes can overlap.  When this happens,
      migration isolates pages without the LRU lock held, corrupting lists
      which will trigger errors in reclaim or during page free such as in the
      following oops
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
        IP: [<ffffffff810f795c>] free_pcppages_bulk+0xcc/0x450
        PGD 1dda554067 PUD 1e1cb58067 PMD 0
        Oops: 0000 [#1] SMP
        CPU 37
        Pid: 17088, comm: memcg_process_s Tainted: G            X
        RIP: free_pcppages_bulk+0xcc/0x450
        Process memcg_process_s (pid: 17088, threadinfo ffff881c2926e000, task ffff881c2926c0c0)
        Call Trace:
          free_hot_cold_page+0x17e/0x1f0
          __pagevec_free+0x90/0xb0
          release_pages+0x22a/0x260
          pagevec_lru_move_fn+0xf3/0x110
          putback_lru_page+0x66/0xe0
          unmap_and_move+0x156/0x180
          migrate_pages+0x9e/0x1b0
          compact_zone+0x1f3/0x2f0
          compact_zone_order+0xa2/0xe0
          try_to_compact_pages+0xdf/0x110
          __alloc_pages_direct_compact+0xee/0x1c0
          __alloc_pages_slowpath+0x370/0x830
          __alloc_pages_nodemask+0x1b1/0x1c0
          alloc_pages_vma+0x9b/0x160
          do_huge_pmd_anonymous_page+0x160/0x270
          do_page_fault+0x207/0x4c0
          page_fault+0x25/0x30
      
      The "X" in the taint flag means that external modules were loaded but but
      is unrelated to the bug triggering.  The real problem was because the PFN
      layout looks like this
      
        Zone PFN ranges:
          DMA      0x00000010 -> 0x00001000
          DMA32    0x00001000 -> 0x00100000
          Normal   0x00100000 -> 0x01e80000
        Movable zone start PFN for each node
        early_node_map[14] active PFN ranges
            0: 0x00000010 -> 0x0000009b
            0: 0x00000100 -> 0x0007a1ec
            0: 0x0007a354 -> 0x0007a379
            0: 0x0007f7ff -> 0x0007f800
            0: 0x00100000 -> 0x00680000
            1: 0x00680000 -> 0x00e80000
            0: 0x00e80000 -> 0x01080000
            1: 0x01080000 -> 0x01280000
            0: 0x01280000 -> 0x01480000
            1: 0x01480000 -> 0x01680000
            0: 0x01680000 -> 0x01880000
            1: 0x01880000 -> 0x01a80000
            0: 0x01a80000 -> 0x01c80000
            1: 0x01c80000 -> 0x01e80000
      
      The fix is straight-forward.  isolate_migratepages() has to make a
      similar check to isolate_freepage to ensure that it never isolates pages
      from a zone it does not hold the LRU lock for.
      
      This was discovered in a 3.0-based kernel but it affects 3.1.x, 3.2.x
      and current mainline.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      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@linuxfoundation.org>
      b9134812
    • Russell King's avatar
      pcmcia: fix socket refcount decrementing on each resume · a5e2ba3e
      Russell King authored
      commit 025e4ab3 upstream.
      
      This fixes a memory-corrupting bug: not only does it cause the warning,
      but as a result of dropping the refcount to zero, it causes the
      pcmcia_socket0 device structure to be freed while it still has
      references, causing slab caches corruption.  A fatal oops quickly
      follows this warning - often even just a 'dmesg' following the warning
      causes the kernel to oops.
      
      While testing suspend/resume on an ARM device with PCMCIA support, and a
      CF card inserted, I found that after five suspend and resumes, the
      kernel would complain, and shortly die after with slab corruption.
      
        WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
      
      As the message doesn't give a clue about which kobject, and the built-in
      debugging in drivers/base/power/main.c happens too late, this was added
      right before each get_device():
      
        printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&dev->kobj), atomic_read(&dev->kobj.kref.refcount));
      
      and on the 3rd s2ram cycle, the following behaviour observed:
      
      On the 3rd suspend/resume cycle:
      
        dpm_prepare: c1a0d998 [pcmcia_socket0] 3
        dpm_suspend: c1a0d998 [pcmcia_socket0] 3
        dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
        dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
        dpm_resume: c1a0d998 [pcmcia_socket0] 3
        dpm_complete: c1a0d998 [pcmcia_socket0] 2
      
      4th:
      
        dpm_prepare: c1a0d998 [pcmcia_socket0] 2
        dpm_suspend: c1a0d998 [pcmcia_socket0] 2
        dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
        dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
        dpm_resume: c1a0d998 [pcmcia_socket0] 2
        dpm_complete: c1a0d998 [pcmcia_socket0] 1
      
      5th:
      
        dpm_prepare: c1a0d998 [pcmcia_socket0] 1
        dpm_suspend: c1a0d998 [pcmcia_socket0] 1
        dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
        dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
        dpm_resume: c1a0d998 [pcmcia_socket0] 1
        dpm_complete: c1a0d998 [pcmcia_socket0] 0
        ------------[ cut here ]------------
        WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
        Modules linked in: ucb1x00_core
        Backtrace:
        [<c0212090>] (dump_backtrace+0x0/0x110) from [<c04799dc>] (dump_stack+0x18/0x1c)
        [<c04799c4>] (dump_stack+0x0/0x1c) from [<c021cba0>] (warn_slowpath_common+0x50/0x68)
        [<c021cb50>] (warn_slowpath_common+0x0/0x68) from [<c021cbdc>] (warn_slowpath_null+0x24/0x28)
        [<c021cbb8>] (warn_slowpath_null+0x0/0x28) from [<c0335374>] (kobject_get+0x28/0x50)
        [<c033534c>] (kobject_get+0x0/0x50) from [<c03804f4>] (get_device+0x1c/0x24)
        [<c0388c90>] (dpm_complete+0x0/0x1a0) from [<c0389cc0>] (dpm_resume_end+0x1c/0x20)
        ...
      
      Looking at commit 7b24e798 ("pcmcia: split up central event handler"),
      the following change was made to cs.c:
      
                      return 0;
              }
       #endif
      -
      -       send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
      +       if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
      +               skt->callback->early_resume(skt);
              return 0;
       }
      
      And the corresponding change in ds.c is from:
      
      -static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
      -{
      -       struct pcmcia_socket *s = pcmcia_get_socket(skt);
      ...
      -       switch (event) {
      ...
      -       case CS_EVENT_PM_RESUME:
      -               if (verify_cis_cache(skt) != 0) {
      -                       dev_dbg(&skt->dev, "cis mismatch - different card\n");
      -                       /* first, remove the card */
      -                       ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
      -                       mutex_lock(&s->ops_mutex);
      -                       destroy_cis_cache(skt);
      -                       kfree(skt->fake_cis);
      -                       skt->fake_cis = NULL;
      -                       s->functions = 0;
      -                       mutex_unlock(&s->ops_mutex);
      -                       /* now, add the new card */
      -                       ds_event(skt, CS_EVENT_CARD_INSERTION,
      -                                CS_EVENT_PRI_LOW);
      -               }
      -               break;
      ...
      -    }
      
      -    pcmcia_put_socket(s);
      
      -    return 0;
      -} /* ds_event */
      
      to:
      
      +static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
      +{
      +       if (!verify_cis_cache(skt)) {
      +               pcmcia_put_socket(skt);
      +               return 0;
      +       }
      
      +       dev_dbg(&skt->dev, "cis mismatch - different card\n");
      
      +       /* first, remove the card */
      +       pcmcia_bus_remove(skt);
      +       mutex_lock(&skt->ops_mutex);
      +       destroy_cis_cache(skt);
      +       kfree(skt->fake_cis);
      +       skt->fake_cis = NULL;
      +       skt->functions = 0;
      +       mutex_unlock(&skt->ops_mutex);
      
      +       /* now, add the new card */
      +       pcmcia_bus_add(skt);
      +       return 0;
      +}
      
      As can be seen, the original function called pcmcia_get_socket() and
      pcmcia_put_socket() around the guts, whereas the replacement code
      calls pcmcia_put_socket() only in one path.  This creates an imbalance
      in the refcounting.
      
      Testing with pcmcia_put_socket() put removed shows that the bug is gone:
      
        dpm_suspend: c1a10998 [pcmcia_socket0] 5
        dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
        dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
        dpm_resume: c1a10998 [pcmcia_socket0] 5
        dpm_complete: c1a10998 [pcmcia_socket0] 5
      Tested-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      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@linuxfoundation.org>
      a5e2ba3e