1. 20 8月, 2017 1 次提交
  2. 18 8月, 2017 5 次提交
    • L
      ACPI: EC: Fix possible issues related to EC initialization order · 69b957c2
      Lv Zheng 提交于
      Use the observation that the EC command/data register addresses are
      sufficient to determine if two EC devices are equivelent to modify
      acpi_is_boot_ec().
      
      Then, for the removed comparison factors, EC ID and EC GPE, they need
      to be synchronized for the boot_ec:
      
       1. Before registering the BIOS-provided EC event handlers in
          acpi_ec_register_query_methods(), the namespace node holding
          _Qxx methods should be located.  The real namespace PNP0C09
          device location then is apparently more trustworthy than the
          ECDT EC ID.
      
       2. Because of the ASUS quirks, the ECDT EC GPE is more trustworthy
          than the namespace PNP0C09 device's _GPE setting.
      
      Use the above observations to synchronize the boot_ec settings in
      acpi_ec_add().
      
      Finally, change the order of acpi_ec_ecdt_start() and acpi_ec_add(),
      called from acpi_bus_register_driver(), so as to follow the fast path
      of determining the location of _Qxx.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      [ rjw : Changelog & comments ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      69b957c2
    • R
      ACPI / scan: Enable GPEs before scanning the namespace · eb7f43c4
      Rafael J. Wysocki 提交于
      On some systems the platform firmware expects GPEs to be enabled
      before the enumeration of devices and if that expectation is not
      met, the systems in question may not boot in some situations.
      
      For this reason, change the initialization ordering of the ACPI
      subsystem to make it enable GPEs before scanning the namespace
      for the first time in order to enumerate devices.
      Reported-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Suggested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NLv Zheng <lv.zheng@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      eb7f43c4
    • R
      ACPICA: Make it possible to enable runtime GPEs earlier · 1312b7e0
      Rafael J. Wysocki 提交于
      Runtime GPEs have corresponding _Lxx/_Exx methods and are enabled
      automatically during the initialization of the ACPI subsystem through
      acpi_update_all_gpes() with the assumption that acpi_setup_gpe_for_wake()
      will be called in advance for all of the GPEs pointed to by _PRW
      objects in the namespace that may be affected by acpi_update_all_gpes().
      That is, acpi_ev_initialize_gpe_block() can only be called for a GPE
      block after acpi_setup_gpe_for_wake() has been called for all of the
      _PRW (wakeup) GPEs in it.
      
      The platform firmware on some systems, however, expects GPEs to be
      enabled before the enumeration of devices which is when
      acpi_setup_gpe_for_wake() is called and that goes against the above
      assumption.
      
      For this reason, introduce a new flag to be set by
      acpi_ev_initialize_gpe_block() when automatically enabling a GPE
      to indicate to acpi_setup_gpe_for_wake() that it needs to drop the
      reference to the GPE coming from acpi_ev_initialize_gpe_block()
      and modify acpi_setup_gpe_for_wake() accordingly.  These changes
      allow acpi_setup_gpe_for_wake() and acpi_ev_initialize_gpe_block()
      to be invoked in any order.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      1312b7e0
    • R
      ACPICA: Dispatch active GPEs at init time · ecc1165b
      Rafael J. Wysocki 提交于
      In some cases GPEs are already active when they are enabled by
      acpi_ev_initialize_gpe_block() and whatever happens next may depend
      on the result of handling the events signaled by them, so the
      events should not be discarded (which is what happens currently) and
      they should be handled as soon as reasonably possible.
      
      For this reason, modify acpi_ev_initialize_gpe_block() to
      dispatch GPEs with the status flag set in-band right after
      enabling them.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      ecc1165b
    • L
      ACPI: EC: Fix regression related to wrong ECDT initialization order · 98529b92
      Lv Zheng 提交于
      Commit 2a570840 (ACPI / EC: Fix a gap that ECDT EC cannot handle
      EC events) introduced acpi_ec_ecdt_start(), but that function is
      invoked before acpi_ec_query_init(), which is too early.  This causes
      the kernel to crash if an EC event occurs after boot, when ec_query_wq
      is not valid:
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000102
       ...
       Workqueue: events acpi_ec_event_handler
       task: ffff9f539790dac0 task.stack: ffffb437c0e10000
       RIP: 0010:__queue_work+0x32/0x430
      
      Normally, the DSDT EC should always be valid, so acpi_ec_ecdt_start()
      is actually a no-op in the majority of cases.  However, commit
      c712bb58 (ACPI / EC: Add support to skip boot stage DSDT probe)
      caused the probing of the DSDT EC as the "boot EC" to be skipped when
      the ECDT EC is valid and uncovered the bug.
      
      Fix this issue by invoking acpi_ec_ecdt_start() after acpi_ec_query_init()
      in acpi_ec_init().
      
      Link: https://jira01.devtools.intel.com/browse/LCK-4348
      Fixes: 2a570840 (ACPI / EC: Fix a gap that ECDT EC cannot handle EC events)
      Fixes: c712bb58 (ACPI / EC: Add support to skip boot stage DSDT probe)
      Reported-by: NWang Wendy <wendy.wang@intel.com>
      Tested-by: NFeng Chenzhou <chenzhoux.feng@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      [ rjw: Changelog ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      98529b92
  3. 13 8月, 2017 1 次提交
  4. 11 8月, 2017 15 次提交
    • A
      iommu/arm-smmu: fix null-pointer dereference in arm_smmu_add_device · a7990c64
      Artem Savkov 提交于
      Commit c54451a5 "iommu/arm-smmu: Fix the error path in arm_smmu_add_device"
      removed fwspec assignment in legacy_binding path as redundant which is
      wrong. It needs to be updated after fwspec initialisation in
      arm_smmu_register_legacy_master() as it is dereferenced later. Without
      this there is a NULL-pointer dereference panic during boot on some hosts.
      Signed-off-by: NArtem Savkov <asavkov@redhat.com>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      a7990c64
    • L
      xen/events: Fix interrupt lost during irq_disable and irq_enable · 020db9d3
      Liu Shuo 提交于
      Here is a device has xen-pirq-MSI interrupt. Dom0 might lost interrupt
      during driver irq_disable/irq_enable. Here is the scenario,
       1. irq_disable -> disable_dynirq -> mask_evtchn(irq channel)
       2. dev interrupt raised by HW and Xen mark its evtchn as pending
       3. irq_enable -> startup_pirq -> eoi_pirq ->
          clear_evtchn(channel of irq) -> clear pending status
       4. consume_one_event process the irq event without pending bit assert
          which result in interrupt lost once
       5. No HW interrupt raising anymore.
      
      Now use enable_dynirq for enable_pirq of xen_pirq_chip to remove
      eoi_pirq when irq_enable.
      Signed-off-by: NLiu Shuo <shuo.a.liu@intel.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      020db9d3
    • J
      xen: avoid deadlock in xenbus · 529871bb
      Juergen Gross 提交于
      When starting the xenwatch thread a theoretical deadlock situation is
      possible:
      
      xs_init() contains:
      
          task = kthread_run(xenwatch_thread, NULL, "xenwatch");
          if (IS_ERR(task))
              return PTR_ERR(task);
          xenwatch_pid = task->pid;
      
      And xenwatch_thread() does:
      
          mutex_lock(&xenwatch_mutex);
          ...
          event->handle->callback();
          ...
          mutex_unlock(&xenwatch_mutex);
      
      The callback could call unregister_xenbus_watch() which does:
      
          ...
          if (current->pid != xenwatch_pid)
              mutex_lock(&xenwatch_mutex);
          ...
      
      In case a watch is firing before xenwatch_pid could be set and the
      callback of that watch unregisters a watch, then a self-deadlock would
      occur.
      
      Avoid this by setting xenwatch_pid in xenwatch_thread().
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      529871bb
    • M
      zram: rework copy of compressor name in comp_algorithm_store() · f357e345
      Matthias Kaehlcke 提交于
      comp_algorithm_store() passes the size of the source buffer to strlcpy()
      instead of the destination buffer size.  Make it explicit that the two
      buffers have the same size and use strcpy() instead of strlcpy().  The
      latter can be done safely since the function ensures that the string in
      the source buffer is terminated.
      
      Link: http://lkml.kernel.org/r/20170803163350.45245-1-mka@chromium.orgSigned-off-by: NMatthias Kaehlcke <mka@chromium.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Reviewed-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: NMinchan Kim <minchan@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f357e345
    • M
      thunderbolt: Do not enumerate more ports from DROM than the controller has · 1cd65d17
      Mika Westerberg 提交于
      Some Alpine Ridge LP DROMs (there might be others) erroneusly list more
      ports than the controller actually has. Most probably because DROM of
      the full Dual/Single port Thunderbolt controller was reused for LP
      version. The current DROM parser does not check the upper bound thus it
      leads to crash when sw->ports[] is accessed over bounds:
      
       BUG: unable to handle kernel NULL pointer dereference at 00000000000002ec
       IP: tb_drom_read+0x383/0x890 [thunderbolt]
       PGD 0
       P4D 0
       Oops: 0000 [#1] SMP
       CPU: 3 PID: 12248 Comm: systemd-udevd Not tainted 4.13.0-rc1-next-20170719 #1
       Hardware name: LENOVO 20HF000YGE/20HF000YGE, BIOS N1WET32W (1.11 ) 05/23/2017
       task: ffff8a293e4bcd80 task.stack: ffffa698027a8000
       RIP: 0010:tb_drom_read+0x383/0x890 [thunderbolt]
       RSP: 0018:ffffa698027ab990 EFLAGS: 00010246
       RAX: 0000000000000000 RBX: ffff8a2940af7800 RCX: 0000000000000000
       RDX: ffff8a2940ebb400 RSI: 0000000000000000 RDI: ffffa698027ab9a0
       RBP: ffffa698027ab9d0 R08: 0000000000000001 R09: 0000000000000002
       R10: ffff8a2940ebb5b0 R11: 0000000000000000 R12: ffff8a293bfa968c
       R13: 000000000000002c R14: 0000000000000056 R15: 0000000000000056
       FS:  00007f0a945a38c0(0000) GS:ffff8a2961580000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00000000000002ec CR3: 000000043e785000 CR4: 00000000003606e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        tb_switch_add+0x9d/0x730 [thunderbolt]
        ? tb_switch_alloc+0x3cd/0x4d0 [thunderbolt]
        icm_start+0x5a/0xa0 [thunderbolt]
        tb_domain_add+0xc3/0xf0 [thunderbolt]
        nhi_probe+0x19e/0x310 [thunderbolt]
        local_pci_probe+0x42/0xa0
        pci_device_probe+0x18d/0x1a0
        driver_probe_device+0x2ff/0x450
        __driver_attach+0xa4/0xe0
        ? driver_probe_device+0x450/0x450
        bus_for_each_dev+0x6e/0xb0
        driver_attach+0x1e/0x20
        bus_add_driver+0x1d0/0x270
        ? 0xffffffffc0bbb000
        driver_register+0x60/0xe0
        ? 0xffffffffc0bbb000
        __pci_register_driver+0x4c/0x50
        nhi_init+0x28/0x1000 [thunderbolt]
        do_one_initcall+0x50/0x190
        ? __vunmap+0x81/0xb0
        ? _cond_resched+0x1a/0x50
        ? kmem_cache_alloc_trace+0x15f/0x1c0
        ? do_init_module+0x27/0x1e9
        do_init_module+0x5f/0x1e9
        load_module+0x24e7/0x2a60
        ? vfs_read+0x115/0x130
        SYSC_finit_module+0xfc/0x120
        ? SYSC_finit_module+0xfc/0x120
        SyS_finit_module+0xe/0x10
        do_syscall_64+0x67/0x170
        entry_SYSCALL64_slow_path+0x25/0x25
      
      Fix this by making sure we only enumerate DROM port entries the hardware
      actually has.
      Reported-by: NChristian Kellner <ckellner@redhat.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NLukas Wunner <lukas@wunner.de>
      Tested-by: NChristian Kellner <ckellner@redhat.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1cd65d17
    • A
      mei: exclude device from suspend direct complete optimization · 557909e1
      Alexander Usyskin 提交于
      MEI device performs link reset during system suspend sequence.
      The link reset cannot be performed while device is in
      runtime suspend state. The resume sequence is bypassed with
      suspend direct complete optimization,so the optimization should be
      disabled for mei devices.
      
      Fixes:
       [  192.940537] Restarting tasks ...
       [  192.940610] PGI is not set
       [  192.940619] ------------[ cut here ]------------ [  192.940623]
       WARNING: CPU: 0
       me.c:653 mei_me_pg_exit_sync+0x351/0x360 [  192.940624] Modules
       linked
       in:
       [  192.940627] CPU: 0 PID: 1661 Comm: kworker/0:3 Not tainted
       4.13.0-rc2+
       #2 [  192.940628] Hardware name: Dell Inc. XPS 13 9343/0TM99H, BIOS
       A11
       12/08/2016 [  192.940630] Workqueue: pm pm_runtime_work <snip> [
       192.940642] Call Trace:
       [  192.940646]  ? pci_pme_active+0x1de/0x1f0 [  192.940649]  ?
       pci_restore_standard_config+0x50/0x50
       [  192.940651]  ? kfree+0x172/0x190
       [  192.940653]  ? kfree+0x172/0x190
       [  192.940655]  ? pci_restore_standard_config+0x50/0x50
       [  192.940663]  mei_me_pm_runtime_resume+0x3f/0xc0
       [  192.940665]  pci_pm_runtime_resume+0x7a/0xa0 [  192.940667]
       __rpm_callback+0xb9/0x1e0 [  192.940668]  ?
       preempt_count_add+0x6d/0xc0 [  192.940670]  rpm_callback+0x24/0x90 [
       192.940672]  ? pci_restore_standard_config+0x50/0x50
       [  192.940674]  rpm_resume+0x4e8/0x800 [  192.940676]
       pm_runtime_work+0x55/0xb0 [  192.940678]
       process_one_work+0x184/0x3e0 [  192.940680]
       worker_thread+0x4d/0x3a0 [ 192.940681]  ?
       preempt_count_sub+0x9b/0x100 [  192.940683]
       kthread+0x122/0x140 [  192.940684]  ? process_one_work+0x3e0/0x3e0 [
       192.940685]  ? __kthread_create_on_node+0x1a0/0x1a0
       [  192.940688]  ret_from_fork+0x27/0x40 [  192.940690] Code: 96 3a
       9e ff 48 8b 7d 98 e8 cd 21 58 00 83 bb bc 01 00 00
       04 0f 85 40 fe ff ff e9 41 fe ff ff 48 c7 c7 5f 04 99 96 e8 93 6b 9f
       ff <0f> ff e9 5d fd ff ff e8 33 fe 99 ff 0f 1f 00 0f 1f 44 00 00 55
       [  192.940719] ---[ end trace
       a86955597774ead8 ]--- [  192.942540] done.
      Suggested-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reported-by: NDominik Brodowski <linux@dominikbrodowski.net>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: NAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      557909e1
    • L
      firmware: avoid invalid fallback aborts by using killable wait · 260d9f2f
      Luis R. Rodriguez 提交于
      Commit 0cb64249 ("firmware_loader: abort request if wait_for_completion
      is interrupted") added via 4.0 added support to abort the fallback mechanism
      when a signal was detected and wait_for_completion_interruptible() returned
      -ERESTARTSYS -- for instance when a user hits CTRL-C. The abort was overly
      *too* effective.
      
      When a child process terminates (successful or not) the signal SIGCHLD can
      be sent to the parent process which ran the child in the background and
      later triggered a sync request for firmware through a sysfs interface which
      relies on the fallback mechanism. This signal in turn can be recieved by the
      interruptible wait we constructed on firmware_class and detects it as an
      abort *before* userspace could get a chance to write the firmware. Upon
      failure -EAGAIN is returned, so userspace is also kept in the dark about
      exactly what happened.
      
      We can reproduce the issue with the fw_fallback.sh selftest:
      
      Before this patch:
      $ sudo tools/testing/selftests/firmware/fw_fallback.sh
      ...
      tools/testing/selftests/firmware/fw_fallback.sh: error - sync firmware request cancelled due to SIGCHLD
      
      After this patch:
      $ sudo tools/testing/selftests/firmware/fw_fallback.sh
      ...
      tools/testing/selftests/firmware/fw_fallback.sh: SIGCHLD on sync ignored as expected
      
      Fix this by making the wait killable -- only killable by SIGKILL (kill -9).
      We loose the ability to allow userspace to cancel a write with CTRL-C
      (SIGINT), however its been decided the compromise to require SIGKILL is
      worth the gains.
      
      Chances of this issue occuring are low due to the number of drivers upstream
      exclusively relying on the fallback mechanism for firmware (2 drivers),
      however this is observed in the field with custom drivers with sysfs
      triggers to load firmware. Only distributions relying on the fallback
      mechanism are impacted as well. An example reported issue was on Android,
      as follows:
      
      1) Android init (pid=1) fork()s (say pid=42) [this child process is totally
         unrelated to firmware loading, it could be sleep 2; for all we care ]
      2) Android init (pid=1) does a write() on a (driver custom) sysfs file which
         ends up calling request_firmware() kernel side
      3) The firmware loading fallback mechanism is used, the request is sent to
         userspace and pid 1 waits in the kernel on wait_*
      4) before firmware loading completes pid 42 dies (for any reason, even
         normal termination)
      5) Kernel delivers SIGCHLD to pid=1 to tell it a child has died, which
         causes -ERESTARTSYS to be returned from wait_*
      6) The kernel's wait aborts and return -EAGAIN for the
         request_firmware() caller.
      
      Cc: stable <stable@vger.kernel.org> # 4.0
      Fixes: 0cb64249 ("firmware_loader: abort request if wait_for_completion is interrupted")
      Suggested-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Suggested-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Tested-by: NMartin Fuzzey <mfuzzey@parkeon.com>
      Reported-by: NMartin Fuzzey <mfuzzey@parkeon.com>
      Signed-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      260d9f2f
    • L
      firmware: fix batched requests - send wake up on failure on direct lookups · 90d41e74
      Luis R. Rodriguez 提交于
      Fix batched requests from waiting forever on failure.
      
      The firmware API batched requests feature has been broken since the API call
      request_firmware_direct() was introduced on commit bba3a87e ("firmware:
      Introduce request_firmware_direct()"), added on v3.14 *iff* the firmware
      being requested was not present in *certain kernel builds* [0].
      
      When no firmware is found the worker which goes on to finish never informs
      waiters queued up of this, so any batched request will stall in what seems
      to be forever (MAX_SCHEDULE_TIMEOUT). Sadly, a reboot will also stall, as
      the reboot notifier was only designed to kill custom fallback workers. The
      issue seems to the user as a type of soft lockup, what *actually* happens
      underneath the hood is a wait call which never completes as we failed to
      issue a completion on error.
      
      For device drivers with optional firmware schemes (ie, Intel iwlwifi, or
      Netronome -- even though it uses request_firmware() and not
      request_firmware_direct()), this could mean that when you boot a system with
      multiple cards the firmware will seem to never load on the system, or that
      the card is just not responsive even the driver initialization. Due to
      differences in scheduling possible this should not always trigger --
      one would need to to ensure that multiple requests are in place at the
      right time for this to work, also release_firmware() must not be called
      prior to any other incoming request. The complexity may not be worth
      supporting batched requests in the future given the wait mechanism is
      only used also for the fallback mechanism. We'll keep it for now and
      just fix it.
      
      Its reported that at least with the Intel WiFi cards on one system this
      issue was creeping up 50% of the boots [0].
      
      Before this commit batched requests testing revealed:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      
      Ater this commit batched testing results:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              OK                  OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              OK                  OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              OK                  OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      
      [0] https://bugzilla.kernel.org/show_bug.cgi?id=195477
      
      Cc: stable <stable@vger.kernel.org> # v3.14
      Fixes: bba3a87e ("firmware: Introduce request_firmware_direct()"
      Reported-by: NNicolas <nbroeking@me.com>
      Reported-by: NJohn Ewalt  <jewalt@lgsinnovations.com>
      Reported-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90d41e74
    • L
      firmware: fix batched requests - wake all waiters · e44565f6
      Luis R. Rodriguez 提交于
      The firmware cache mechanism serves two purposes, the secondary purpose is
      not well documented nor understood. This fixes a regression with the
      secondary purpose of the firmware cache mechanism: batched requests on
      successful lookups. Without this fix *any* time a batched request is
      triggered, secondary requests for which the batched request mechanism
      was designed for will seem to last forver and seem to never return.
      This issue is present for all kernel builds possible, and a hard reset
      is required.
      
      The firmware cache is used for:
      
      1) Addressing races with file lookups during the suspend/resume cycle
         by keeping firmware in memory during the suspend/resume cycle
      
      2) Batched requests for the same file rely only on work from the first file
         lookup, which keeps the firmware in memory until the last
         release_firmware() is called
      
      Batched requests *only* take effect if secondary requests come in prior to
      the first user calling release_firmware(). The devres name used for the
      internal firmware cache is used as a hint other pending requests are
      ongoing, the firmware buffer data is kept in memory until the last user of
      the buffer calls release_firmware(), therefore serializing requests and
      delaying the release until all requests are done.
      
      Batched requests wait for a wakup or signal so we can rely on the first file
      fetch to write to the pending secondary requests. Commit 5b029624
      ("firmware: do not use fw_lock for fw_state protection") ported the firmware
      API to use swait, and in doing so failed to convert complete_all() to
      swake_up_all() -- it used swake_up(), loosing the ability for *some* batched
      requests to take effect.
      
      We *could* fix this by just using swake_up_all() *but* swait is now known
      to be very special use case, so its best to just move away from it. So we
      just go back to using completions as before commit 5b029624 ("firmware:
      do not use fw_lock for fw_state protection") given this was using
      complete_all().
      
      Without this fix it has been reported plugging in two Intel 6260 Wifi cards
      on a system will end up enumerating the two devices only 50% of the time
      [0]. The ported swake_up() should have actually handled the case with two
      devices, however, *if more than two cards are used* the swake_up() would
      not have sufficed. This change is only part of the required fixes for
      batched requests. Another fix is provided in the next patch.
      
      This particular change should fix the cases where more than three requests
      with the same firmware name is used, otherwise batched requests will wait
      for MAX_SCHEDULE_TIMEOUT and just timeout eventually.
      
      Below is a summary of tests triggering batched requests on different
      kernel builds.
      
      Before this patch:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                FAIL
      request_firmware_direct()              FAIL                FAIL
      request_firmware_nowait(uevent=true)   FAIL                FAIL
      request_firmware_nowait(uevent=false)  FAIL                FAIL
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                FAIL
      request_firmware_direct()              FAIL                FAIL
      request_firmware_nowait(uevent=true)   FAIL                FAIL
      request_firmware_nowait(uevent=false)  FAIL                FAIL
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                FAIL
      request_firmware_direct()              FAIL                FAIL
      request_firmware_nowait(uevent=true)   FAIL                FAIL
      request_firmware_nowait(uevent=false)  FAIL                FAIL
      ============================================================================
      
      After this patch:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      
      [0] https://bugzilla.kernel.org/show_bug.cgi?id=195477
      
      CC: <stable@vger.kernel.org>    [4.10+]
      Cc: Ming Lei <ming.lei@redhat.com>
      Fixes: 5b029624 ("firmware: do not use fw_lock for fw_state protection")
      Reported-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e44565f6
    • G
      USB: serial: pl2303: add new ATEN device id · 3b6bcd3d
      Greg Kroah-Hartman 提交于
      This adds a new ATEN device id for a new pl2303-based device.
      Reported-by: NPeter Kuo <PeterKuo@aten.com.tw>
      Cc: stable <stable@vger.kernel.org>
      Cc: Johan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b6bcd3d
    • K
      usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter · 7496cfe5
      Kai-Heng Feng 提交于
      Moshi USB to Ethernet Adapter internally uses a Genesys Logic hub to
      connect to Realtek r8153.
      
      The Realtek r8153 ethernet does not work on the internal hub, no-lpm quirk
      can make it work.
      
      Since another r8153 dongle at my hand does not have the issue, so add
      the quirk to the Genesys Logic hub instead.
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7496cfe5
    • A
      USB: Check for dropped connection before switching to full speed · 94c43b98
      Alan Stern 提交于
      Some buggy USB disk adapters disconnect and reconnect multiple times
      during the enumeration procedure.  This may lead to a device
      connecting at full speed instead of high speed, because when the USB
      stack sees that a device isn't able to enumerate at high speed, it
      tries to hand the connection over to a full-speed companion
      controller.
      
      The logic for doing this is careful to check that the device is still
      connected.  But this check is inadequate if the device disconnects and
      reconnects before the check is done.  The symptom is that a device
      works, but much more slowly than it is capable of operating.
      
      The situation was made worse recently by commit 22547c4c ("usb:
      hub: Wait for connection to be reestablished after port reset"), which
      increases the delay following a reset before a disconnect is
      recognized, thus giving the device more time to reconnect.
      
      This patch makes the check more robust.  If the device was
      disconnected at any time during enumeration, we will now skip the
      full-speed handover.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: NZdenek Kabelac <zkabelac@redhat.com>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94c43b98
    • S
      usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume · e788787e
      Sandeep Singh 提交于
      Certain HP keyboards would keep inputting a character automatically which
      is the wake-up key after S3 resume
      
      On some AMD platforms USB host fails to respond (by holding resume-K) to
      USB device (an HP keyboard) resume request within 1ms (TURSM) and ensures
      that resume is signaled for at least 20 ms (TDRSMDN), which is defined in
      USB 2.0 spec. The result is that the keyboard is out of function.
      
      In SNPS USB design, the host responds to the resume request only after
      system gets back to S0 and the host gets to functional after the internal
      HW restore operation that is more than 1 second after the initial resume
      request from the USB device.
      
      As a workaround for specific keyboard ID(HP Keyboards), applying port reset
      after resume when the keyboard is plugged in.
      Signed-off-by: NSandeep Singh <Sandeep.Singh@amd.com>
      Signed-off-by: NShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      cc: Nehal Shah <Nehal-bakulchandra.Shah@amd.com>
      Reviewed-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e788787e
    • K
      nvme: fix directive command numd calculation · a082b426
      Kwan (Hingkwan) Huen-SSI 提交于
      The numd field of directive receive command takes number of dwords to
      transfer. This fix has the correct calculation for numd.
      Signed-off-by: NKwan (Hingkwan) Huen-SSI <kwan.huen@samsung.com>
      Reviewed-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      a082b426
    • K
      nvme: fix nvme reset command timeout handling · 634b8325
      Keith Busch 提交于
      We need to return an error if a timeout occurs on any NVMe command during
      initialization. Without this, the nvme reset work will be stuck. A timeout
      will have a negative error code, meaning we need to stop initializing
      the controller. All postitive returns mean the controller is still usable.
      
      bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196325Signed-off-by: NKeith Busch <keith.busch@intel.com>
      Cc: Martin Peres <martin.peres@intel.com>
      [jth consolidated cleanup path ]
      Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      634b8325
  5. 10 8月, 2017 10 次提交
    • M
      nvme-pci: fix CMB sysfs file removal in reset path · 1c78f773
      Max Gurtovoy 提交于
      Currently we create the sysfs entry even if we fail mapping
      it. In that case, the unmapping will not remove the sysfs created
      file. There is no good reason to create a sysfs entry for a non
      working CMB and show his characteristics.
      
      Fixes: f63572df ("nvme: unmap CMB and remove sysfs file in reset path")
      Signed-off-by: NMax Gurtovoy <maxg@mellanox.com>
      Reviewed-by: NStephen Bates <sbates@raithlin.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      1c78f773
    • J
      lpfc: support nvmet_fc defer_rcv callback · 50738420
      James Smart 提交于
      Currently, calls to nvmet_fc_rcv_fcp_req() always copied the
      FC-NVME cmd iu to a temporary buffer before returning, allowing
      the driver to immediately repost the buffer to the hardware.
      
      To address timing conditions on queue element structures vs async
      command reception, the nvmet_fc transport occasionally may need to
      hold on to the command iu buffer for a short period. In these cases,
      the nvmet_fc_rcv_fcp_req() will return a special return code
      (-EOVERFLOW). In these cases, the LLDD must delay until the new
      defer_rcv lldd callback is called before recycling the buffer back
      to the hw.
      
      This patch adds support for the new nvmet_fc transport defer_rcv
      callback and recognition of the new error code when passing commands
      to the transport.
      Signed-off-by: NDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: NJames Smart <james.smart@broadcom.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      50738420
    • J
      nvmet_fc: add defer_req callback for deferment of cmd buffer return · 0fb228d3
      James Smart 提交于
      At queue creation, the transport allocates a local job struct
      (struct nvmet_fc_fcp_iod) for each possible element of the queue.
      When a new CMD is received from the wire, a jobs struct is allocated
      from the queue and then used for the duration of the command.
      The job struct contains buffer space for the wire command iu. Thus,
      upon allocation of the job struct, the cmd iu buffer is copied to
      the job struct and the LLDD may immediately free/reuse the CMD IU
      buffer passed in the call.
      
      However, in some circumstances, due to the packetized nature of FC
      and the api of the FC LLDD which may issue a hw command to send the
      wire response, but the LLDD may not get the hw completion for the
      command and upcall the nvmet_fc layer before a new command may be
      asynchronously received on the wire. In other words, its possible
      for the initiator to get the response from the wire, thus believe a
      command slot free, and send a new command iu. The new command iu
      may be received by the LLDD and passed to the transport before the
      LLDD had serviced the hw completion and made the teardown calls for
      the original job struct. As such, there is no available job struct
      available for the new io. E.g. it appears like the host sent more
      queue elements than the queue size. It didn't based on it's
      understanding.
      
      Rather than treat this as a hard connection failure queue the new
      request until the job struct does free up. As the buffer isn't
      copied as there's no job struct, a special return value must be
      returned to the LLDD to signify to hold off on recycling the cmd
      iu buffer.  And later, when a job struct is allocated and the
      buffer copied, a new LLDD callback is introduced to notify the
      LLDD and allow it to recycle it's command iu buffer.
      Signed-off-by: NJames Smart <james.smart@broadcom.com>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      0fb228d3
    • M
      nvme: strip trailing 0-bytes in wwid_show · 758f3735
      Martin Wilck 提交于
      Some broken controllers (such as earlier Linux targets) pad model or
      serial fields with 0-bytes rather than spaces. The NVMe spec disallows
      0 bytes in "ASCII" fields.  Thus strip trailing 0-bytes, too. Also make
      sure that we get no underflow for pathological input.
      Signed-off-by: NMartin Wilck <mwilck@suse.com>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NKeith Busch <keith.busch@intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      758f3735
    • G
      geneve: maximum value of VNI cannot be used · 04db70d9
      Girish Moodalbail 提交于
      Geneve's Virtual Network Identifier (VNI) is 24 bit long, so the range
      of values for it would be from 0 to 16777215 (2^24 -1).  However, one
      cannot create a geneve device with VNI set to 16777215. This patch fixes
      this issue.
      Signed-off-by: NGirish Moodalbail <girish.moodalbail@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      04db70d9
    • F
      net: systemport: Fix software statistics for SYSTEMPORT Lite · 50ddfbaf
      Florian Fainelli 提交于
      With SYSTEMPORT Lite we have holes in our statistics layout that make us
      skip over the hardware MIB counters, bcm_sysport_get_stats() was not
      taking that into account resulting in reporting 0 for all SW-maintained
      statistics, fix this by skipping accordingly.
      
      Fixes: 44a4524c ("net: systemport: Add support for SYSTEMPORT Lite")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      50ddfbaf
    • J
      sunvdc: prevent sunvdc panic when mpgroup disk added to guest domain · 3ee70591
      Jim Quigley 提交于
      Using mpgroup to define multiple paths for a virtual disk causes multiple
      virtual-device-port ports to be created for that virtual device.
      Each virtual-device-port port then gets a vdisk created for it by the Linux
      sunvdc driver. As mpgroup is not supported by the Linux sunvdc driver it
      cannot handle multiple ports for a single vdisk, leading to a kernel panic
      at startup.
      
      This fix prevents more than one vdisk per virtual-device-port being created
      until full virtual disk multipathing (mpgroup) support is implemented.
      Signed-off-by: NJim Quigley <Jim.Quigley@oracle.com>
      Reviewed-by: NLiam Merwick <liam.merwick@oracle.com>
      Reviewed-by: NShannon Nelson <shannon.nelson@oracle.com>
      Reviewed-by: NAlexandre Chartre <alexandre.chartre@oracle.com>
      Reviewed-by: NAaron Young <aaron.young@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3ee70591
    • N
      target: Fix node_acl demo-mode + uncached dynamic shutdown regression · 6f48655f
      Nicholas Bellinger 提交于
      This patch fixes a generate_node_acls = 1 + cache_dynamic_acls = 0
      regression, that was introduced by
      
        commit 01d4d673
        Author: Nicholas Bellinger <nab@linux-iscsi.org>
        Date:   Wed Dec 7 12:55:54 2016 -0800
      
      which originally had the proper list_del_init() usage, but was
      dropped during list review as it was thought unnecessary by HCH.
      
      However, list_del_init() usage is required during the special
      generate_node_acls = 1 + cache_dynamic_acls = 0 case when
      transport_free_session() does a list_del(&se_nacl->acl_list),
      followed by target_complete_nacl() doing the same thing.
      
      This was manifesting as a general protection fault as reported
      by Justin:
      
      kernel: general protection fault: 0000 [#1] SMP
      kernel: Modules linked in:
      kernel: CPU: 0 PID: 11047 Comm: iscsi_ttx Not tainted 4.13.0-rc2.x86_64.1+ #20
      kernel: Hardware name: Intel Corporation S5500BC/S5500BC, BIOS S5500.86B.01.00.0064.050520141428 05/05/2014
      kernel: task: ffff88026939e800 task.stack: ffffc90007884000
      kernel: RIP: 0010:target_put_nacl+0x49/0xb0
      kernel: RSP: 0018:ffffc90007887d70 EFLAGS: 00010246
      kernel: RAX: dead000000000200 RBX: ffff8802556ca000 RCX: 0000000000000000
      kernel: RDX: dead000000000100 RSI: 0000000000000246 RDI: ffff8802556ce028
      kernel: RBP: ffffc90007887d88 R08: 0000000000000001 R09: 0000000000000000
      kernel: R10: ffffc90007887df8 R11: ffffea0009986900 R12: ffff8802556ce020
      kernel: R13: ffff8802556ce028 R14: ffff8802556ce028 R15: ffffffff88d85540
      kernel: FS:  0000000000000000(0000) GS:ffff88027fc00000(0000) knlGS:0000000000000000
      kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      kernel: CR2: 00007fffe36f5f94 CR3: 0000000009209000 CR4: 00000000003406f0
      kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      kernel: Call Trace:
      kernel:  transport_free_session+0x67/0x140
      kernel:  transport_deregister_session+0x7a/0xc0
      kernel:  iscsit_close_session+0x92/0x210
      kernel:  iscsit_close_connection+0x5f9/0x840
      kernel:  iscsit_take_action_for_connection_exit+0xfe/0x110
      kernel:  iscsi_target_tx_thread+0x140/0x1e0
      kernel:  ? wait_woken+0x90/0x90
      kernel:  kthread+0x124/0x160
      kernel:  ? iscsit_thread_get_cpumask+0x90/0x90
      kernel:  ? kthread_create_on_node+0x40/0x40
      kernel:  ret_from_fork+0x22/0x30
      kernel: Code: 00 48 89 fb 4c 8b a7 48 01 00 00 74 68 4d 8d 6c 24 08 4c
      89 ef e8 e8 28 43 00 48 8b 93 20 04 00 00 48 8b 83 28 04 00 00 4c 89
      ef <48> 89 42 08 48 89 10 48 b8 00 01 00 00 00 00 ad de 48 89 83 20
      kernel: RIP: target_put_nacl+0x49/0xb0 RSP: ffffc90007887d70
      kernel: ---[ end trace f12821adbfd46fed ]---
      
      To address this, go ahead and use proper list_del_list() for all
      cases of se_nacl->acl_list deletion.
      Reported-by: NJustin Maggard <jmaggard01@gmail.com>
      Tested-by: NJustin Maggard <jmaggard01@gmail.com>
      Cc: Justin Maggard <jmaggard01@gmail.com>
      Cc: stable@vger.kernel.org # 4.1+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6f48655f
    • B
      drm/nouveau/disp/nv04: avoid creation of output paths · 372aa73e
      Ben Skeggs 提交于
      Fixes hitting WARN_ON() during initialisation of pre-NV50 GPUs, caused
      by the recent changes to support pad macro routing on GM20x.
      
      We currently don't use them here for older GPUs anyway.
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      372aa73e
    • M
      drm: make DRM_STM default n · 92f190ab
      Michał Mirosław 提交于
      Default config value for all other drivers is N.
      Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      92f190ab
  6. 09 8月, 2017 8 次提交
    • M
      mmc: block: fix lockdep splat when removing mmc_block module · 3f8b23a0
      Michał Mirosław 提交于
      Fix lockdep splat introduced in v4.13-rc4.
      
      [  266.297226] ------------[ cut here ]------------
      [  266.300078] WARNING: CPU: 2 PID: 176 at /mnt/src/jaja/git/tf300t/include/linux/blkdev.h:657 mmc_blk_remove_req+0xd0/0xe8 [mmc_block]
      [  266.302937] Modules linked in: mmc_block(-) sdhci_tegra sdhci_pltfm sdhci pwrseq_simple pwrseq_emmc mmc_core
      [  266.305941] CPU: 2 PID: 176 Comm: rmmod Tainted: G        W       4.13.0-rc4mq-00208-gb691e67724b8-dirty #694
      [  266.308852] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
      [  266.311719] [<b011144c>] (unwind_backtrace) from [<b010ca54>] (show_stack+0x18/0x1c)
      [  266.314664] [<b010ca54>] (show_stack) from [<b062e3f4>] (dump_stack+0x84/0x98)
      [  266.317644] [<b062e3f4>] (dump_stack) from [<b01214f4>] (__warn+0xf4/0x10c)
      [  266.320542] [<b01214f4>] (__warn) from [<b01215d4>] (warn_slowpath_null+0x28/0x30)
      [  266.323534] [<b01215d4>] (warn_slowpath_null) from [<af067858>] (mmc_blk_remove_req+0xd0/0xe8 [mmc_block])
      [  266.326568] [<af067858>] (mmc_blk_remove_req [mmc_block]) from [<af068f40>] (mmc_blk_remove_parts.constprop.6+0x50/0x64 [mmc_block])
      [  266.329678] [<af068f40>] (mmc_blk_remove_parts.constprop.6 [mmc_block]) from [<af0693b8>] (mmc_blk_remove+0x24/0x140 [mmc_block])
      [  266.332894] [<af0693b8>] (mmc_blk_remove [mmc_block]) from [<af0052ec>] (mmc_bus_remove+0x20/0x28 [mmc_core])
      [  266.336198] [<af0052ec>] (mmc_bus_remove [mmc_core]) from [<b046aa64>] (device_release_driver_internal+0x164/0x200)
      [  266.339367] [<b046aa64>] (device_release_driver_internal) from [<b046ab54>] (driver_detach+0x40/0x74)
      [  266.342537] [<b046ab54>] (driver_detach) from [<b046982c>] (bus_remove_driver+0x68/0xdc)
      [  266.345660] [<b046982c>] (bus_remove_driver) from [<af06ad40>] (mmc_blk_exit+0xc/0x2cc [mmc_block])
      [  266.348875] [<af06ad40>] (mmc_blk_exit [mmc_block]) from [<b01aee30>] (SyS_delete_module+0x1c4/0x254)
      [  266.352068] [<b01aee30>] (SyS_delete_module) from [<b0108480>] (ret_fast_syscall+0x0/0x34)
      [  266.355308] ---[ end trace f68728a0d3053b72 ]---
      
      Fixes: 7c84b8b4 ("mmc: block: bypass the queue even if usage is present for hotplug")
      Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      3f8b23a0
    • B
      qmi_wwan: fix NULL deref on disconnect · bbae08e5
      Bjørn Mork 提交于
      qmi_wwan_disconnect is called twice when disconnecting devices with
      separate control and data interfaces.  The first invocation will set
      the interface data to NULL for both interfaces to flag that the
      disconnect has been handled.  But the matching NULL check was left
      out when qmi_wwan_disconnect was added, resulting in this oops:
      
        usb 2-1.4: USB disconnect, device number 4
        qmi_wwan 2-1.4:1.6 wwp0s29u1u4i6: unregister 'qmi_wwan' usb-0000:00:1d.0-1.4, WWAN/QMI device
        BUG: unable to handle kernel NULL pointer dereference at 00000000000000e0
        IP: qmi_wwan_disconnect+0x25/0xc0 [qmi_wwan]
        PGD 0
        P4D 0
        Oops: 0000 [#1] SMP
        Modules linked in: <stripped irrelevant module list>
        CPU: 2 PID: 33 Comm: kworker/2:1 Tainted: G            E   4.12.3-nr44-normandy-r1500619820+ #1
        Hardware name: LENOVO 4291LR7/4291LR7, BIOS CBET4000 4.6-810-g50522254fb 07/21/2017
        Workqueue: usb_hub_wq hub_event [usbcore]
        task: ffff8c882b716040 task.stack: ffffb8e800d84000
        RIP: 0010:qmi_wwan_disconnect+0x25/0xc0 [qmi_wwan]
        RSP: 0018:ffffb8e800d87b38 EFLAGS: 00010246
        RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffff8c8824f3f1d0 RDI: ffff8c8824ef6400
        RBP: ffff8c8824ef6400 R08: 0000000000000000 R09: 0000000000000000
        R10: ffffb8e800d87780 R11: 0000000000000011 R12: ffffffffc07ea0e8
        R13: ffff8c8824e2e000 R14: ffff8c8824e2e098 R15: 0000000000000000
        FS:  0000000000000000(0000) GS:ffff8c8835300000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00000000000000e0 CR3: 0000000229ca5000 CR4: 00000000000406e0
        Call Trace:
         ? usb_unbind_interface+0x71/0x270 [usbcore]
         ? device_release_driver_internal+0x154/0x210
         ? qmi_wwan_unbind+0x6d/0xc0 [qmi_wwan]
         ? usbnet_disconnect+0x6c/0xf0 [usbnet]
         ? qmi_wwan_disconnect+0x87/0xc0 [qmi_wwan]
         ? usb_unbind_interface+0x71/0x270 [usbcore]
         ? device_release_driver_internal+0x154/0x210
      Reported-and-tested-by: NNathaniel Roach <nroach44@gmail.com>
      Fixes: c6adf779 ("net: usb: qmi_wwan: add qmap mux protocol support")
      Cc: Daniele Palmas <dnlplm@gmail.com>
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bbae08e5
    • G
      ppp: fix xmit recursion detection on ppp channels · 0a0e1a85
      Guillaume Nault 提交于
      Commit e5dadc65 ("ppp: Fix false xmit recursion detect with two ppp
      devices") dropped the xmit_recursion counter incrementation in
      ppp_channel_push() and relied on ppp_xmit_process() for this task.
      But __ppp_channel_push() can also send packets directly (using the
      .start_xmit() channel callback), in which case the xmit_recursion
      counter isn't incremented anymore. If such packets get routed back to
      the parent ppp unit, ppp_xmit_process() won't notice the recursion and
      will call ppp_channel_push() on the same channel, effectively creating
      the deadlock situation that the xmit_recursion mechanism was supposed
      to prevent.
      
      This patch re-introduces the xmit_recursion counter incrementation in
      ppp_channel_push(). Since the xmit_recursion variable is now part of
      the parent ppp unit, incrementation is skipped if the channel doesn't
      have any. This is fine because only packets routed through the parent
      unit may enter the channel recursively.
      
      Finally, we have to ensure that pch->ppp is not going to be modified
      while executing ppp_channel_push(). Instead of taking this lock only
      while calling ppp_xmit_process(), we now have to hold it for the full
      ppp_channel_push() execution. This respects the ppp locks ordering
      which requires locking ->upl before ->downl.
      
      Fixes: e5dadc65 ("ppp: Fix false xmit recursion detect with two ppp devices")
      Signed-off-by: NGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0a0e1a85
    • J
      net: dsa: mediatek: add adjust link support for user ports · 8e6f1521
      John Crispin 提交于
      Manually adjust the port settings of user ports once PHY polling has
      completed. This patch extends the adjust_link callback to configure the
      per port PMCR register, applying the proper values polled from the PHY.
      Without this patch flow control was not always getting setup properly.
      Signed-off-by: NShashidhar Lakkavalli <shashidhar.lakkavalli@openmesh.com>
      Signed-off-by: NMuciri Gatimu <muciri@openmesh.com>
      Signed-off-by: NJohn Crispin <john@phrozen.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8e6f1521
    • D
      net/mlx4_en: don't set CHECKSUM_COMPLETE on SCTP packets · e718fe45
      Davide Caratti 提交于
      if the NIC fails to validate the checksum on TCP/UDP, and validation of IP
      checksum is successful, the driver subtracts the pseudo-header checksum
      from the value obtained by the hardware and sets CHECKSUM_COMPLETE. Don't
      do that if protocol is IPPROTO_SCTP, otherwise CRC32c validation fails.
      
      V2: don't test MLX4_CQE_STATUS_IPV6 if MLX4_CQE_STATUS_IPV4 is set
      Reported-by: NShuang Li <shuali@redhat.com>
      Fixes: f8c6455b ("net/mlx4_en: Extend checksum offloading by CHECKSUM COMPLETE")
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e718fe45
    • M
      drm/exynos: forbid creating framebuffers from too small GEM buffers · 1899bd57
      Marek Szyprowski 提交于
      Add a check if the framebuffer described by the provided drm_mode_fb_cmd2
      structure fits into provided GEM buffers. Without this check it is
      possible to create a framebuffer object from a small buffer and set it to
      the hardware, what results in displaying system memory outside the
      allocated GEM buffer.
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Reviewed-by: NTobias Jakobi <tjakobi@math.uni-bielefeld.de>
      Signed-off-by: NInki Dae <inki.dae@samsung.com>
      1899bd57
    • H
      mmc: mmc: correct the logic for setting HS400ES signal voltage · 92ddd959
      Haibo Chen 提交于
      Change the default err value to -EINVAL, make sure the card only
      has type EXT_CSD_CARD_TYPE_HS400_1_8V also do the signal voltage
      setting when select hs400es mode.
      
      Fixes: commit 1720d354 ("mmc: core: switch to 1V8 or 1V2 for hs400es mode")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NHaibo Chen <haibo.chen@nxp.com>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      92ddd959
    • H
      random: fix warning message on ia64 and parisc · 51d96dc2
      Helge Deller 提交于
      Fix the warning message on the parisc and IA64 architectures to show the
      correct function name of the caller by using %pS instead of %pF. The
      message is printed with the value of _RET_IP_ which calls
      __builtin_return_address(0) and as such returns the IP address caller
      instead of pointer to a function descriptor of the caller.
      
      The effect of this patch is visible on the parisc and ia64 architectures
      only since those are the ones which use function descriptors while on
      all others %pS and %pF will behave the same.
      
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Fixes: eecabf56 ("random: suppress spammy warnings about unseeded randomness")
      Fixes: d06bfd19 ("random: warn when kernel uses unseeded randomness")
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      51d96dc2