1. 14 2月, 2012 1 次提交
  2. 09 2月, 2012 2 次提交
    • R
      pcmcia: fix socket refcount decrementing on each resume · 025e4ab3
      Russell King 提交于
      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: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      025e4ab3
    • A
      drivers/leds/leds-lm3530.c: fix setting pltfm->als_vmax · ec44fd42
      Axel Lin 提交于
      In current code, pltfm->als_vmin is set to LM3530_ALS_WINDOW_mV and
      pltfm->als_vmax is 0.  This does not make sense.  I think what we want
      here is setting pltfm->als_vmax to LM3530_ALS_WINDOW_mV.
      
      Both als_vmin and als_vmax local variables will be set to
      pltfm->als_vmin and pltfm->als_vmax by a few lines latter.  Thus also
      remove a redundant assignment for als_vmin and als_vmax in this patch.
      Signed-off-by: NAxel Lin <axel.lin@gmail.com>
      Cc: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
      Acked-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Tested-by: NMilo(Woogyom) Kim <milo.kim@ti.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ec44fd42
  3. 08 2月, 2012 1 次提交
  4. 07 2月, 2012 12 次提交
  5. 06 2月, 2012 3 次提交
  6. 05 2月, 2012 1 次提交
  7. 04 2月, 2012 6 次提交
  8. 03 2月, 2012 6 次提交
  9. 02 2月, 2012 8 次提交
    • I
      drm/radeon/kms/blit: fix blit copy for very large buffers · 52b53a0b
      Ilija Hadzic 提交于
      Evergreen and NI blit copy was broken if the buffer maps to a rectangle
      whose one dimension is 16384 (max dimension allowed by these chips).
      In the mainline kernel, the problem is exposed only when buffers are
      very large (1G), but it's still a problem. The problem could be exposed
      for smaller buffers if anyone modifies the algorithm for rectangle
      construction in r600_blit_create_rect() (the reason why someone would
      modify that algorithm is to tune the performance of buffer moves).
      
      The root cause was in i2f() function which only operated on range between
      0 and 16383. Fix this by extending the range of i2f() function to 0 to
      32767.
      
      While at it improve the function so that the range can be easily
      extended in the future (if it becomes necessary), cleanup lines
      over 80 characters, and replace in-line comments with one strategic
      comment that explains the crux of the function.
      
      Credits to michel@daenzer.net for pointing out the root cause of
      the bug.
      
      v2: Fix I2F_MAX_INPUT constant definition goof and warn only once
          if input argument is out of range. Edit the comment a little
          bit to avoid some linguistic confusion and make it look better
          in general.
      Signed-off-by: NIlija Hadzic <ihadzic@research.bell-labs.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NMichel Dänzer <michel@daenzer.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      52b53a0b
    • A
      drm/radeon/kms: fix TRAVIS panel setup · 304a4840
      Alex Deucher 提交于
      Different versions of the DP to LVDS bridge chip
      need different panel mode settings depending on
      the chip version used.
      
      Fixes:
      https://bugs.freedesktop.org/show_bug.cgi?id=41569Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      304a4840
    • D
      drm/radeon: fix use after free in ATRM bios reading code. · de47a9cd
      Dave Airlie 提交于
      Fixes:
      https://bugs.freedesktop.org/show_bug.cgi?id=45503
      
      Reported-and-Debugged-by: mlambda@gmail.com
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      de47a9cd
    • K
      HID: hyperv: Properly disconnect the input device · c1c454b8
      K. Y. Srinivasan 提交于
      When we unload the mouse driver, properly disconnect the input device.
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
      Reported-by: NFuzhou Chen <fuzhouch@microsoft.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      c1c454b8
    • M
      HID: usbhid: fix dead lock between open and disconect · ba18311d
      Ming Lei 提交于
      There is no reason to hold hiddev->existancelock before
      calling usb_deregister_dev, so move it out of the lock.
      
      The patch fixes the lockdep warning below.
      
      [ 5733.386271] ======================================================
      [ 5733.386274] [ INFO: possible circular locking dependency detected ]
      [ 5733.386278] 3.2.0-custom-next-20120111+ #1 Not tainted
      [ 5733.386281] -------------------------------------------------------
      [ 5733.386284] khubd/186 is trying to acquire lock:
      [ 5733.386288]  (minor_rwsem){++++.+}, at: [<ffffffffa0011a04>] usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386311]
      [ 5733.386312] but task is already holding lock:
      [ 5733.386315]  (&hiddev->existancelock){+.+...}, at: [<ffffffffa0094d17>] hiddev_disconnect+0x26/0x87 [usbhid]
      [ 5733.386328]
      [ 5733.386329] which lock already depends on the new lock.
      [ 5733.386330]
      [ 5733.386333]
      [ 5733.386334] the existing dependency chain (in reverse order) is:
      [ 5733.386336]
      [ 5733.386337] -> #1 (&hiddev->existancelock){+.+...}:
      [ 5733.386346]        [<ffffffff81082d26>] lock_acquire+0xcb/0x10e
      [ 5733.386357]        [<ffffffff813df961>] __mutex_lock_common+0x60/0x465
      [ 5733.386366]        [<ffffffff813dfe4d>] mutex_lock_nested+0x36/0x3b
      [ 5733.386371]        [<ffffffffa0094ad6>] hiddev_open+0x113/0x193 [usbhid]
      [ 5733.386378]        [<ffffffffa0011971>] usb_open+0x66/0xc2 [usbcore]
      [ 5733.386390]        [<ffffffff8111a8b5>] chrdev_open+0x12b/0x154
      [ 5733.386402]        [<ffffffff811159a8>] __dentry_open.isra.16+0x20b/0x355
      [ 5733.386408]        [<ffffffff811165dc>] nameidata_to_filp+0x43/0x4a
      [ 5733.386413]        [<ffffffff81122ed5>] do_last+0x536/0x570
      [ 5733.386419]        [<ffffffff8112300b>] path_openat+0xce/0x301
      [ 5733.386423]        [<ffffffff81123327>] do_filp_open+0x33/0x81
      [ 5733.386427]        [<ffffffff8111664d>] do_sys_open+0x6a/0xfc
      [ 5733.386431]        [<ffffffff811166fb>] sys_open+0x1c/0x1e
      [ 5733.386434]        [<ffffffff813e7c79>] system_call_fastpath+0x16/0x1b
      [ 5733.386441]
      [ 5733.386441] -> #0 (minor_rwsem){++++.+}:
      [ 5733.386448]        [<ffffffff8108255d>] __lock_acquire+0xa80/0xd74
      [ 5733.386454]        [<ffffffff81082d26>] lock_acquire+0xcb/0x10e
      [ 5733.386458]        [<ffffffff813e01f5>] down_write+0x44/0x77
      [ 5733.386464]        [<ffffffffa0011a04>] usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386475]        [<ffffffffa0094d2d>] hiddev_disconnect+0x3c/0x87 [usbhid]
      [ 5733.386483]        [<ffffffff8132df51>] hid_disconnect+0x3f/0x54
      [ 5733.386491]        [<ffffffff8132dfb4>] hid_device_remove+0x4e/0x7a
      [ 5733.386496]        [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386502]        [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386507]        [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386512]        [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386519]        [<ffffffff8132def3>] hid_destroy_device+0x1e/0x3d
      [ 5733.386525]        [<ffffffffa00916b0>] usbhid_disconnect+0x36/0x42 [usbhid]
      [ 5733.386530]        [<ffffffffa000fb60>] usb_unbind_interface+0x57/0x11f [usbcore]
      [ 5733.386542]        [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386547]        [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386552]        [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386557]        [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386562]        [<ffffffffa000de61>] usb_disable_device+0xa8/0x1d8 [usbcore]
      [ 5733.386573]        [<ffffffffa0006bd2>] usb_disconnect+0xab/0x11f [usbcore]
      [ 5733.386583]        [<ffffffffa0008aa0>] hub_thread+0x73b/0x1157 [usbcore]
      [ 5733.386593]        [<ffffffff8105dc0f>] kthread+0x95/0x9d
      [ 5733.386601]        [<ffffffff813e90b4>] kernel_thread_helper+0x4/0x10
      [ 5733.386607]
      [ 5733.386608] other info that might help us debug this:
      [ 5733.386609]
      [ 5733.386612]  Possible unsafe locking scenario:
      [ 5733.386613]
      [ 5733.386615]        CPU0                    CPU1
      [ 5733.386618]        ----                    ----
      [ 5733.386620]   lock(&hiddev->existancelock);
      [ 5733.386625]                                lock(minor_rwsem);
      [ 5733.386630]                                lock(&hiddev->existancelock);
      [ 5733.386635]   lock(minor_rwsem);
      [ 5733.386639]
      [ 5733.386640]  *** DEADLOCK ***
      [ 5733.386641]
      [ 5733.386644] 6 locks held by khubd/186:
      [ 5733.386646]  #0:  (&__lockdep_no_validate__){......}, at: [<ffffffffa00084af>] hub_thread+0x14a/0x1157 [usbcore]
      [ 5733.386661]  #1:  (&__lockdep_no_validate__){......}, at: [<ffffffffa0006b77>] usb_disconnect+0x50/0x11f [usbcore]
      [ 5733.386677]  #2:  (hcd->bandwidth_mutex){+.+.+.}, at: [<ffffffffa0006bc8>] usb_disconnect+0xa1/0x11f [usbcore]
      [ 5733.386693]  #3:  (&__lockdep_no_validate__){......}, at: [<ffffffff812c09bb>] device_release_driver+0x18/0x2d
      [ 5733.386704]  #4:  (&__lockdep_no_validate__){......}, at: [<ffffffff812c09bb>] device_release_driver+0x18/0x2d
      [ 5733.386714]  #5:  (&hiddev->existancelock){+.+...}, at: [<ffffffffa0094d17>] hiddev_disconnect+0x26/0x87 [usbhid]
      [ 5733.386727]
      [ 5733.386727] stack backtrace:
      [ 5733.386731] Pid: 186, comm: khubd Not tainted 3.2.0-custom-next-20120111+ #1
      [ 5733.386734] Call Trace:
      [ 5733.386741]  [<ffffffff81062881>] ? up+0x34/0x3b
      [ 5733.386747]  [<ffffffff813d9ef3>] print_circular_bug+0x1f8/0x209
      [ 5733.386752]  [<ffffffff8108255d>] __lock_acquire+0xa80/0xd74
      [ 5733.386756]  [<ffffffff810808b4>] ? trace_hardirqs_on_caller+0x15d/0x1a3
      [ 5733.386763]  [<ffffffff81043a3f>] ? vprintk+0x3f4/0x419
      [ 5733.386774]  [<ffffffffa0011a04>] ? usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386779]  [<ffffffff81082d26>] lock_acquire+0xcb/0x10e
      [ 5733.386789]  [<ffffffffa0011a04>] ? usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386797]  [<ffffffff813e01f5>] down_write+0x44/0x77
      [ 5733.386807]  [<ffffffffa0011a04>] ? usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386818]  [<ffffffffa0011a04>] usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386825]  [<ffffffffa0094d2d>] hiddev_disconnect+0x3c/0x87 [usbhid]
      [ 5733.386830]  [<ffffffff8132df51>] hid_disconnect+0x3f/0x54
      [ 5733.386834]  [<ffffffff8132dfb4>] hid_device_remove+0x4e/0x7a
      [ 5733.386839]  [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386844]  [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386848]  [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386854]  [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386859]  [<ffffffff8132def3>] hid_destroy_device+0x1e/0x3d
      [ 5733.386865]  [<ffffffffa00916b0>] usbhid_disconnect+0x36/0x42 [usbhid]
      [ 5733.386876]  [<ffffffffa000fb60>] usb_unbind_interface+0x57/0x11f [usbcore]
      [ 5733.386882]  [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386886]  [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386890]  [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386895]  [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386905]  [<ffffffffa000de61>] usb_disable_device+0xa8/0x1d8 [usbcore]
      [ 5733.386916]  [<ffffffffa0006bd2>] usb_disconnect+0xab/0x11f [usbcore]
      [ 5733.386921]  [<ffffffff813dff82>] ? __mutex_unlock_slowpath+0x130/0x141
      [ 5733.386929]  [<ffffffffa0008aa0>] hub_thread+0x73b/0x1157 [usbcore]
      [ 5733.386935]  [<ffffffff8106a51d>] ? finish_task_switch+0x78/0x150
      [ 5733.386941]  [<ffffffff8105e396>] ? __init_waitqueue_head+0x4c/0x4c
      [ 5733.386950]  [<ffffffffa0008365>] ? usb_remote_wakeup+0x56/0x56 [usbcore]
      [ 5733.386955]  [<ffffffff8105dc0f>] kthread+0x95/0x9d
      [ 5733.386961]  [<ffffffff813e90b4>] kernel_thread_helper+0x4/0x10
      [ 5733.386966]  [<ffffffff813e24b8>] ? retint_restore_args+0x13/0x13
      [ 5733.386970]  [<ffffffff8105db7a>] ? __init_kthread_worker+0x55/0x55
      [ 5733.386974]  [<ffffffff813e90b0>] ? gs_change+0x13/0x13
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ba18311d
    • P
      i.MX SDMA: Fix burstsize settings · 94ac27a5
      Philippe Rétornaz 提交于
      Commit 6584cb88 (ARM i.MX dma: Fix burstsize settings) fixed
      the mxcmmc driver but forgot to fix the SDMA driver to handle the
      correct burtsize.
      This make the SD card access works again with DMA on i.MX31 boards.
      Signed-off-by: NPhilippe Rétornaz <philippe.retornaz@epfl.ch>
      Tested-by: NSascha Hauer <s.hauer@pengutronix.de>
      Acked-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NVinod Koul <vinod.koul@linux.intel.com>
      94ac27a5
    • A
      gpio: Add missing spin_lock_init in gpio-ml-ioh driver · 7e3a70fb
      Axel Lin 提交于
      This bug was introduced by commit 54be5663
      "gpio-ml-ioh: Support interrupt function" which adds a spinlock to struct
      ioh_gpio but never init the spinlock.
      Signed-off-by: NAxel Lin <axel.lin@gmail.com>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      7e3a70fb
    • A
      gpio: Add missing spin_lock_init in gpio-pch driver · d166370a
      Axel Lin 提交于
      This bug was introduced by commit d568a681
      "gpio-pch: add spinlock in suspend/resume processing"
      which adds a spinlock to struct pch_gpio but never init the spinlock.
      Reported-by: NTomoya MORINAGA <tomoya.rohm@gmail.com>
      Signed-off-by: NAxel Lin <axel.lin@gmail.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      d166370a