1. 02 4月, 2013 3 次提交
    • P
      cpufreq: check OF node /cpus presence before dereferencing it · f5c3ef21
      Paolo Pisati 提交于
      Check for the presence of the '/cpus' OF node before dereferencing it
      blindly:
      
      [    4.181793] Unable to handle kernel NULL pointer dereference at virtual address 0000001c
      [    4.181793] pgd = c0004000
      [    4.181823] [0000001c] *pgd=00000000
      [    4.181823] Internal error: Oops: 5 [#1] SMP ARM
      [    4.181823] Modules linked in:
      [    4.181823] CPU: 1    Tainted: G        W     (3.8.0-15-generic #25~hbankD)
      [    4.181854] PC is at of_get_next_child+0x64/0x70
      [    4.181854] LR is at of_get_next_child+0x24/0x70
      [    4.181854] pc : [<c04fda18>]    lr : [<c04fd9d8>]    psr: 60000113
      [    4.181854] sp : ed891ec0  ip : ed891ec0  fp : ed891ed4
      [    4.181884] r10: c04dafd0  r9 : c098690c  r8 : c0936208
      [    4.181884] r7 : ed890000  r6 : c0a63d00  r5 : 00000000  r4 : 00000000
      [    4.181884] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : c0b2acc8
      [    4.181884] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      [    4.181884] Control: 10c5387d  Table: adcb804a  DAC: 00000015
      [    4.181915] Process swapper/0 (pid: 1, stack limit = 0xed890238)
      [    4.181915] Stack: (0xed891ec0 to 0xed892000)
      [    4.181915] 1ec0: c09b7b70 00000007 ed891efc ed891ed8 c04daff4 c04fd9c0 00000000 c09b7b70
      [    4.181915] 1ee0: 00000007 c0a63d00 ed890000 c0936208 ed891f54 ed891f00 c00088e0 c04dafdc
      [    4.181945] 1f00: ed891f54 ed891f10 c006e940 00000000 00000000 00000007 00000007 c08a4914
      [    4.181945] 1f20: 00000000 c07dbd30 c0a63d00 c09b7b70 00000007 c0a63d00 000000bc c0936208
      [    4.181945] 1f40: c098690c c0986914 ed891f94 ed891f58 c0936a40 c00087bc 00000007 00000007
      [    4.181976] 1f60: c0936208 be8bda20 b6eea010 c0a63d00 c064547c 00000000 00000000 00000000
      [    4.181976] 1f80: 00000000 00000000 ed891fac ed891f98 c0645498 c09368c8 00000000 00000000
      [    4.181976] 1fa0: 00000000 ed891fb0 c0014658 c0645488 00000000 00000000 00000000 00000000
      [    4.182006] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [    4.182006] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [    4.182037] [<c04fda18>] (of_get_next_child+0x64/0x70) from [<c04daff4>] (cpu0_cpufreq_driver_init+0x24/0x284)
      [    4.182067] [<c04daff4>] (cpu0_cpufreq_driver_init+0x24/0x284) from [<c00088e0>] (do_one_initcall+0x130/0x1b0)
      [    4.182067] [<c00088e0>] (do_one_initcall+0x130/0x1b0) from [<c0936a40>] (kernel_init_freeable+0x184/0x24c)
      [    4.182098] [<c0936a40>] (kernel_init_freeable+0x184/0x24c) from [<c0645498>] (kernel_init+0x1c/0xf4)
      [    4.182128] [<c0645498>] (kernel_init+0x1c/0xf4) from [<c0014658>] (ret_from_fork+0x14/0x20)
      [    4.182128] Code: f57ff04f e320f004 e89da830 e89da830 (e595001c)
      [    4.182128] ---[ end trace 634903a22e8609cb ]---
      [    4.182189] Kernel panic - not syncing: Attempted to kill init!  exitcode=0x0000000b
      [    4.182189]
      [    4.642395] CPU0: stopping
      
      [rjw: Changelog]
      Signed-off-by: NPaolo Pisati <paolo.pisati@canonical.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f5c3ef21
    • R
      PM / QoS: Avoid possible deadlock related to sysfs access · 0f703069
      Rafael J. Wysocki 提交于
      Commit b81ea1b5 (PM / QoS: Fix concurrency issues and memory leaks in
      device PM QoS) put calls to pm_qos_sysfs_add_latency(),
      pm_qos_sysfs_add_flags(), pm_qos_sysfs_remove_latency(), and
      pm_qos_sysfs_remove_flags() under dev_pm_qos_mtx, which was a
      mistake, because it may lead to deadlocks in some situations.
      For example, if pm_qos_remote_wakeup_store() is run in parallel
      with dev_pm_qos_constraints_destroy(), they may deadlock in the
      following way:
      
       ======================================================
       [ INFO: possible circular locking dependency detected ]
       3.9.0-rc4-next-20130328-sasha-00014-g91a3267 #319 Tainted: G        W
       -------------------------------------------------------
       trinity-child6/12371 is trying to acquire lock:
        (s_active#54){++++.+}, at: [<ffffffff81301631>] sysfs_addrm_finish+0x31/0x60
      
       but task is already holding lock:
        (dev_pm_qos_mtx){+.+.+.}, at: [<ffffffff81f07cc3>] dev_pm_qos_constraints_destroy+0x23/0x250
      
       which lock already depends on the new lock.
      
       the existing dependency chain (in reverse order) is:
      
       -> #1 (dev_pm_qos_mtx){+.+.+.}:
              [<ffffffff811811da>] lock_acquire+0x1aa/0x240
              [<ffffffff83dab809>] __mutex_lock_common+0x59/0x5e0
              [<ffffffff83dabebf>] mutex_lock_nested+0x3f/0x50
              [<ffffffff81f07f2f>] dev_pm_qos_update_flags+0x3f/0xc0
              [<ffffffff81f05f4f>] pm_qos_remote_wakeup_store+0x3f/0x70
              [<ffffffff81efbb43>] dev_attr_store+0x13/0x20
              [<ffffffff812ffdaa>] sysfs_write_file+0xfa/0x150
              [<ffffffff8127f2c1>] __kernel_write+0x81/0x150
              [<ffffffff812afc2d>] write_pipe_buf+0x4d/0x80
              [<ffffffff812af57c>] splice_from_pipe_feed+0x7c/0x120
              [<ffffffff812afa25>] __splice_from_pipe+0x45/0x80
              [<ffffffff812b14fc>] splice_from_pipe+0x4c/0x70
              [<ffffffff812b1538>] default_file_splice_write+0x18/0x30
              [<ffffffff812afae3>] do_splice_from+0x83/0xb0
              [<ffffffff812afb2e>] direct_splice_actor+0x1e/0x20
              [<ffffffff812b0277>] splice_direct_to_actor+0xe7/0x200
              [<ffffffff812b15bc>] do_splice_direct+0x4c/0x70
              [<ffffffff8127eda9>] do_sendfile+0x169/0x300
              [<ffffffff8127ff94>] SyS_sendfile64+0x64/0xb0
              [<ffffffff83db7d18>] tracesys+0xe1/0xe6
      
       -> #0 (s_active#54){++++.+}:
              [<ffffffff811800cf>] __lock_acquire+0x15bf/0x1e50
              [<ffffffff811811da>] lock_acquire+0x1aa/0x240
              [<ffffffff81300aa2>] sysfs_deactivate+0x122/0x1a0
              [<ffffffff81301631>] sysfs_addrm_finish+0x31/0x60
              [<ffffffff812ff77f>] sysfs_hash_and_remove+0x7f/0xb0
              [<ffffffff813035a1>] sysfs_unmerge_group+0x51/0x70
              [<ffffffff81f068f4>] pm_qos_sysfs_remove_flags+0x14/0x20
              [<ffffffff81f07490>] __dev_pm_qos_hide_flags+0x30/0x70
              [<ffffffff81f07cd5>] dev_pm_qos_constraints_destroy+0x35/0x250
              [<ffffffff81f06931>] dpm_sysfs_remove+0x11/0x50
              [<ffffffff81efcf6f>] device_del+0x3f/0x1b0
              [<ffffffff81efd128>] device_unregister+0x48/0x60
              [<ffffffff82d4083c>] usb_hub_remove_port_device+0x1c/0x20
              [<ffffffff82d2a9cd>] hub_disconnect+0xdd/0x160
              [<ffffffff82d36ab7>] usb_unbind_interface+0x67/0x170
              [<ffffffff81f001a7>] __device_release_driver+0x87/0xe0
              [<ffffffff81f00559>] device_release_driver+0x29/0x40
              [<ffffffff81effc58>] bus_remove_device+0x148/0x160
              [<ffffffff81efd07f>] device_del+0x14f/0x1b0
              [<ffffffff82d344f9>] usb_disable_device+0xf9/0x280
              [<ffffffff82d34ff8>] usb_set_configuration+0x268/0x840
              [<ffffffff82d3a7fc>] usb_remove_store+0x4c/0x80
              [<ffffffff81efbb43>] dev_attr_store+0x13/0x20
              [<ffffffff812ffdaa>] sysfs_write_file+0xfa/0x150
              [<ffffffff8127f71d>] do_loop_readv_writev+0x4d/0x90
              [<ffffffff8127f999>] do_readv_writev+0xf9/0x1e0
              [<ffffffff8127faba>] vfs_writev+0x3a/0x60
              [<ffffffff8127fc60>] SyS_writev+0x50/0xd0
              [<ffffffff83db7d18>] tracesys+0xe1/0xe6
      
       other info that might help us debug this:
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(dev_pm_qos_mtx);
                                      lock(s_active#54);
                                      lock(dev_pm_qos_mtx);
         lock(s_active#54);
      
        *** DEADLOCK ***
      
      To avoid that, remove the calls to functions mentioned above from
      under dev_pm_qos_mtx and introduce a separate lock to prevent races
      between functions that add or remove device PM QoS sysfs attributes
      from happening.
      Reported-by: NSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0f703069
    • R
      USB / PM: Don't try to hide PM QoS flags from usb_port_device_release() · da259465
      Rafael J. Wysocki 提交于
      Remove the call to dev_pm_qos_hide_flags(), added by commit 6e30d7cb
      "usb: Add driver/usb/core/(port.c,hub.h) files", from
      usb_port_device_release(), because (1) it is completely unnecessary
      (the flags have been removed already by the PM core during the
      unregistration of the device object) and (2) it triggers a NULL
      pointer dereference in sysfs_find_dirent() (dev->kobj.sd is NULL at
      this point).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da259465
  2. 30 3月, 2013 3 次提交
  3. 29 3月, 2013 2 次提交
    • N
      target: Fix RESERVATION_CONFLICT status regression for iscsi-target special case · f85eda8d
      Nicholas Bellinger 提交于
      This patch fixes a regression introduced in v3.8-rc1 code where a failed
      target_check_reservation() check in target_setup_cmd_from_cdb() was causing
      an incorrect SAM_STAT_GOOD status to be returned during a WRITE operation
      performed by an unregistered / unreserved iscsi initiator port.
      
      This regression is only effecting iscsi-target due to a special case check
      for TCM_RESERVATION_CONFLICT within iscsi_target_erl1.c:iscsit_execute_cmd(),
      and was still correctly disallowing WRITE commands from backend submission
      for unregistered / unreserved initiator ports, while returning the incorrect
      SAM_STAT_GOOD status due to the missing SAM_STAT_RESERVATION_CONFLICT
      assignment.
      
      This regression was first introduced with:
      
      commit de103c93
      Author: Christoph Hellwig <hch@lst.de>
      Date:   Tue Nov 6 12:24:09 2012 -0800
      
          target: pass sense_reason as a return value
      
      Go ahead and re-add the missing SAM_STAT_RESERVATION_CONFLICT assignment
      during a target_check_reservation() failure, so that iscsi-target code
      sends the correct SCSI status.
      
      All other fabrics using target_submit_cmd_*() with a RESERVATION_CONFLICT
      call to transport_generic_request_failure() are not effected by this bug.
      Reported-by: NJeff Leung <jleung@curriegrad2004.ca>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f85eda8d
    • N
      tcm_vhost: Avoid VIRTIO_RING_F_EVENT_IDX feature bit · 5dade710
      Nicholas Bellinger 提交于
      This patch adds a VHOST_SCSI_FEATURES mask minus VIRTIO_RING_F_EVENT_IDX
      so that vhost-scsi-pci userspace will strip this feature bit once
      GET_FEATURES reports it as being unsupported on the host.
      
      This is to avoid a bug where ->handle_kicks() are missed when EVENT_IDX
      is enabled by default in userspace code.
      
      (mst: Rename to VHOST_SCSI_FEATURES + add comment)
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NAsias He <asias@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5dade710
  4. 28 3月, 2013 4 次提交
  5. 27 3月, 2013 12 次提交
  6. 26 3月, 2013 16 次提交
    • W
      x86, io_apic: remove duplicated include from irq_remapping.c · 4fdc7824
      Wei Yongjun 提交于
      Remove duplicated include.
      Signed-off-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Signed-off-by: NJoerg Roedel <joro@8bytes.org>
      4fdc7824
    • H
      [media] [REGRESSION] bt8xx: Fix too large height in cropcap · 35ccecef
      Hans de Goede 提交于
      Since commit a1fd2877:
      "[media] bttv-driver: fix two warnings"
      cropcap.defrect.height and cropcap.bounds.height for the PAL entry are 32
      resp 30 pixels too large, if a userspace app (ie xawtv) actually tries to use
      the full advertised height, the resulting image is broken in ways only a
      screenshot can describe.
      The cause of this is the fix for this warning:
      drivers/media/pci/bt8xx/bttv-driver.c:308:3: warning: initialized field overwritten [-Woverride-init]
      In this chunk of the commit:
      @@ -301,11 +301,10 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                              /* totalwidth */ 1135,
                              /* sqwidth */ 944,
                              /* vdelay */ 0x20,
      -                       /* sheight */ 576,
      -                       /* videostart0 */ 23)
                      /* bt878 (and bt848?) can capture another
                         line below active video. */
      -               .cropcap.bounds.height = (576 + 2) + 0x20 - 2,
      +                       /* sheight */ (576 + 2) + 0x20 - 2,
      +                       /* videostart0 */ 23)
              },{
                      .v4l2_id        = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR,
                      .name           = "NTSC",
      Which replaces the overriding of cropcap.bounds.height initialization outside
      of the CROPCAP macro (which also initializes it), with passing a
      different sheight value to the CROPCAP macro.
      There are 2 problems with this warning fix:
      1) The sheight value is used twice in the CROPCAP macro, and the old code
         only changed one resulting value.
      2) The old code increased the .cropcap.bounds.height value (and did not
         touch the .cropcap.defrect.height value at all) by 2, where as the fixed
         code increases it by 32, as the fixed code passes (576 + 2) + 0x20 - 2
         to the CROPCAP macro, but the + 0x20 - 2 is already done by the macro so
         now is done twice for .cropcap.bounds.height, and also is applied to
         .cropcap.defrect.height where it should not be applied at all.
      This patch fixes this by adding an extraheight parameter to the CROPCAP entry
      and using it for the PAL entry.
      
      Cc: stable@kernel.org	# For Kernel 3.8
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      35ccecef
    • J
      igb: fix PHC stopping on max freq · 75517d92
      Jiri Benc 提交于
      For 82576 MAC type, max_adj is reported as 1000000000 ppb. However, if
      this value is passed to igb_ptp_adjfreq_82576, incvalue overflows out of
      INCVALUE_82576_MASK, resulting in setting of zero TIMINCA.incvalue, stopping
      the PHC (instead of going at twice the nominal speed).
      
      Fix the advertised max_adj value to the largest value hardware can handle.
      As there is no min_adj value available (-max_adj is used instead), this will
      also prevent stopping the clock intentionally. It's probably not a big deal,
      other igb MAC types don't support stopping the clock, either.
      Signed-off-by: NJiri Benc <jbenc@redhat.com>
      Acked-by: NMatthew Vick <matthew.vick@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      75517d92
    • S
      igb: make sensor info static · 05ec29e8
      Stephen Hemminger 提交于
      Trivial sparse warning.
      Signed-off-by: NStephen Hemminger <stephen@networkplumber.org>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      05ec29e8
    • A
      igb: SR-IOV init reordering · d5e51a10
      Alex Williamson 提交于
      igb is ineffective at setting a lower total VFs because:
      
      int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
      {
              ...
              /* Shouldn't change if VFs already enabled */
              if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)
                      return -EBUSY;
      
      Swap init ordering.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NGreg Rose <gregory.v.rose@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d5e51a10
    • A
      igb: Fix null pointer dereference · d0f63acc
      Alex Williamson 提交于
      The max_vfs= option has always been self limiting to the number of VFs
      supported by the device.  fa44f2f1 added SR-IOV configuration via
      sysfs, but in the process broke this self correction factor.  The
      failing path is:
      
      igb_probe
        igb_sw_init
          if (max_vfs > 7) {
              adapter->vfs_allocated_count = 7;
          ...
          igb_probe_vfs
          igb_enable_sriov(, max_vfs)
            if (num_vfs > 7) {
              err = -EPERM;
              ...
      
      This leaves vfs_allocated_count = 7 and vf_data = NULL, so we bomb out
      when igb_probe finally calls igb_reset.  It seems like a really bad
      idea, and somewhat pointless, to set vfs_allocated_count separate from
      vf_data, but limiting max_vfs is enough to avoid the null pointer.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NGreg Rose <gregory.v.rose@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d0f63acc
    • L
      igb: fix i350 anti spoofing config · 22c12752
      Lior Levy 提交于
      Fix a problem in i350 where anti spoofing configuration was written into a
      wrong register.
      Signed-off-by: NLior Levy <lior.levy@intel.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      22c12752
    • X
      ixgbevf: don't release the soft entries · a1f6c6b1
      xunleer 提交于
      When the ixgbevf driver is opened the request to allocate MSIX irq
      vectors may fail.  In that case the driver will call ixgbevf_down()
      which will call ixgbevf_irq_disable() to clear the HW interrupt
      registers and calls synchronize_irq() using the msix_entries pointer in
      the adapter structure.  However, when the function to request the MSIX
      irq vectors failed it had already freed the msix_entries which causes
      an OOPs from using the NULL pointer in synchronize_irq().
      
      The calls to pci_disable_msix() and to free the msix_entries memory
      should not occur if device open fails.  Instead they should be called
      during device driver removal to balance with the call to
      pci_enable_msix() and the call to allocate msix_entries memory
      during the device probe and driver load.
      Signed-off-by: NLi Xun <xunleer.li@huawei.com>
      Signed-off-by: NGreg Rose <gregory.v.rose@intel.com>
      Tested-by: NSibai Li <sibai.li@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      a1f6c6b1
    • P
      block: removes dynamic allocation on stack · d8d595df
      Philip J Kelleher 提交于
      This patch removes dynamic allocation on the stack error.
      Signed-off-by: NPhilip J Kelleher <pjk1939@linux.vnet.ibm.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      d8d595df
    • J
      Xilinx: ARM: UART: clear pending irqs before enabling irqs · 855f6fd9
      John Linn 提交于
      The Boot ROM has an issue which will cause the driver to
      lock up as pending irqs are not being cleared. With them
      cleared it prevents that issue.
      
      This patch is needed for the current (3.9-rc3) mainline kernel. I guess
      it went unnoticed, because it was only tested with u-boot up until now.
      And u-boot maybe handles this.
      
      [s.trumtrar@pengutronix.de: cherry-picked from linux-xlnx.git]
      Signed-off-by: NSteffen Trumtrar <s.trumtrar@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      855f6fd9
    • J
      TTY: 8250, deprecated 8250_core.* options · 9326b047
      Jiri Slaby 提交于
      They were introduced by mistake in 3.7. Let's deprecate them now. For
      the reasons, see the text in Kconfig below.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Josh Boyer <jwboyer@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9326b047
    • J
      TTY: 8250, revert module name change · 9196d8ac
      Jiri Slaby 提交于
      In 3.7 the 8250 module name was changed unintentionally from 8250 to
      8250_core by commit 835d844d
      (8250_pnp: do pnp probe before legacy probe). We then had to
      re-introduce the old module options to ensure the old good
      8250.nr_uart & co. still work. This can be done only by a very dirty
      hack and we did it in f2b8dfd9
      (serial: 8250: Keep 8250.<xxxx> module options functional after driver
      rename).
      
      That is so damn ugly so that I decided to revert to the old module
      name and deprecate the new 8250_core options present in 3.7 and 3.8
      only. The deprecation will happen in the following patch.
      
      Note that this patch changes the hack above to support "8250_core.*",
      because we now have "8250.*" natively.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Josh Boyer <jwboyer@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9196d8ac
    • S
      USB: EHCI: fix bug in iTD/siTD DMA pool allocation · 85ecd032
      Soeren Moch 提交于
      [Description written by Alan Stern]
      
      Soeren tracked down a very difficult bug in ehci-hcd's DMA pool
      management of iTD and siTD structures.  Some background: ehci-hcd
      gives each isochronous endpoint its own set of active and free itd's
      (or sitd's for full-speed devices).  When a new itd is needed, it is
      taken from the head of the free list, if possible.  However, itd's
      must not be used twice in a single frame because the hardware
      continues to access the data structure for the entire duration of a
      frame.  Therefore if the itd at the head of the free list has its
      "frame" member equal to the current value of ehci->now_frame, it
      cannot be reused and instead a new itd is allocated from the DMA pool.
      The entries on the free list are not released back to the pool until
      the endpoint is no longer in use.
      
      The bug arises from the fact that sometimes an itd can be moved back
      onto the free list before itd->frame has been set properly.  In
      Soeren's case, this happened because ehci-hcd can allocate one more
      itd than it actually needs for an URB; the extra itd may or may not be
      required depending on how the transfer aligns with a frame boundary.
      For example, an URB with 8 isochronous packets will cause two itd's to
      be allocated.  If the URB is scheduled to start in microframe 3 of
      frame N then it will require both itds: one for microframes 3 - 7 of
      frame N and one for microframes 0 - 2 of frame N+1.  But if the URB
      had been scheduled to start in microframe 0 then it would require only
      the first itd, which could cover microframes 0 - 7 of frame N.  The
      second itd would be returned to the end of the free list.
      
      The itd allocation routine initializes the entire structure to 0, so
      the extra itd ends up on the free list with itd->frame set to 0
      instead of a meaningful value.  After a while the itd reaches the head
      of the list, and occasionally this happens when ehci->now_frame is
      equal to 0.  Then, even though it would be okay to reuse this itd, the
      driver thinks it must get another itd from the DMA pool.
      
      For as long as the isochronous endpoint remains in use, this flaw in
      the mechanism causes more and more itd's to be taken slowly from the
      DMA pool.  Since none are released back, the pool eventually becomes
      exhausted.
      
      This reuslts in memory allocation failures, which typically show up
      during a long-running audio stream.  Video might suffer the same
      effect.
      
      The fix is very simple.  To prevent allocations from the pool when
      they aren't needed, make sure that itd's sent back to the free list
      prematurely have itd->frame set to an invalid value which can never be
      equal to ehci->now_frame.
      
      This should be applied to -stable kernels going back to 3.6.
      Signed-off-by: NSoeren Moch <smoch@web.de>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85ecd032
    • I
      staging: comedi: s626: fix continuous acquisition · e4317ce8
      Ian Abbott 提交于
      For the s626 driver, there is a bug in the handling of asynchronous
      commands on the AI subdevice when the stop source is `TRIG_NONE`.  The
      command should run continuously until cancelled, but the interrupt
      handler stops the command running after the first scan.
      
      The command set-up function `s626_ai_cmd()` contains this code:
      
      	switch (cmd->stop_src) {
      	case TRIG_COUNT:
      		/*  data arrives as one packet */
      		devpriv->ai_sample_count = cmd->stop_arg;
      		devpriv->ai_continous = 0;
      		break;
      	case TRIG_NONE:
      		/*  continous acquisition */
      		devpriv->ai_continous = 1;
      		devpriv->ai_sample_count = 0;
      		break;
      	}
      
      The interrupt handler `s626_irq_handler()` contains this code:
      
      		if (!(devpriv->ai_continous))
      			devpriv->ai_sample_count--;
      		if (devpriv->ai_sample_count <= 0) {
      			devpriv->ai_cmd_running = 0;
      			/* ... */
      		}
      
      So `devpriv->ai_sample_count` is only decremented for the `TRIG_COUNT`
      case, but `devpriv->ai_cmd_running` is set to 0 (and the command
      stopped) regardless.
      
      Fix this in `s626_ai_cmd()` by setting `devpriv->ai_sample_count = 1`
      for the `TRIG_NONE` case.  The interrupt handler will not decrement it
      so it will remain greater than 0 and the check for stopping the
      acquisition will fail.
      
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4317ce8
    • M
      [media] fix compilation with both V4L2 and I2C as 'm' · 532ee00c
      Mauro Carvalho Chehab 提交于
      When config options are:
      	CONFIG_VIDEO_DEV=y
      	CONFIG_VIDEO_V4L2=m
      	CONFIG_I2C=m
      
      Compilation breaks, as reported by:
      	https://bugzilla.kernel.org/show_bug.cgi?id=55681
      
      Before changeset 7b34be71,
      no compilation errors occurred. However, the I2C code there at
      v4l2-device was incorrectly disabled.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
      532ee00c
    • S
      xhci: Don't warn on empty ring for suspended devices. · a83d6755
      Sarah Sharp 提交于
      When a device attached to the roothub is suspended, the endpoint rings
      are stopped.  The host may generate a completion event with the
      completion code set to 'Stopped' or 'Stopped Invalid' when the ring is
      halted.  The current xHCI code prints a warning in that case, which can
      be really annoying if the USB device is coming into and out of suspend.
      
      Remove the unnecessary warning.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NStephen Hemminger <stephen@networkplumber.org>
      a83d6755