1. 09 11月, 2017 2 次提交
    • C
      drm/i915: Deconstruct struct sgt_dma initialiser · 423a8a94
      Chris Wilson 提交于
      gcc-4.4 complains about:
      
      	struct sgt_dma iter = {
      		.sg = vma->pages->sgl,
      		.dma = sg_dma_address(iter.sg),
      		.max = iter.dma + iter.sg->length,
      	};
      
      drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen8_ppgtt_insert_4lvl’:
      drivers/gpu/drm/i915/i915_gem_gtt.c:938: error: ‘iter.sg’ is used uninitialized in this function
      drivers/gpu/drm/i915/i915_gem_gtt.c:939: error: ‘iter.dma’ is used uninitialized in this function
      
      and worse generates invalid code that triggers a GPF:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
      IP: gen8_ppgtt_insert_4lvl+0x1b/0x1e0 [i915]
      PGD 0
      Oops: 0000 [#1] SMP
      Modules linked in: snd_aloop nf_conntrack_ipv6 nf_defrag_ipv6 nf_log_ipv6 ip6table_filter ip6_tables ctr ccm xt_state nf_log_ipv4
      nf_log_common xt_LOG xt_limit xt_recent xt_owner xt_addrtype iptable_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat
      nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c ip_tables dm_mod vhost_net macvtap macvlan vhost tun kvm_intel kvm
      irqbypass uas usb_storage hid_multitouch btusb btrtl uvcvideo videobuf2_v4l2 videobuf2_core videodev media videobuf2_vmalloc videobuf2_memops
      sg ppdev dell_wmi sparse_keymap mei_wdt sd_mod iTCO_wdt iTCO_vendor_support rtsx_pci_ms memstick rtsx_pci_sdmmc mmc_core dell_smm_hwmon hwmon
      dell_laptop dell_smbios dcdbas joydev input_leds hci_uart btintel btqca btbcm bluetooth parport_pc parport i2c_hid
        intel_lpss_acpi intel_lpss pcspkr wmi int3400_thermal acpi_thermal_rel dell_rbtn mei_me mei snd_hda_codec_hdmi snd_hda_codec_realtek
      snd_hda_codec_generic ahci libahci acpi_pad xhci_pci xhci_hcd snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device
      snd_pcm snd_timer snd soundcore int3403_thermal arc4 e1000e ptp pps_core i2c_i801 iwlmvm mac80211 rtsx_pci iwlwifi cfg80211 rfkill
      intel_pch_thermal processor_thermal_device int340x_thermal_zone intel_soc_dts_iosf i915 video fjes
      CPU: 2 PID: 2408 Comm: X Not tainted 4.10.0-rc5+ #1
      Hardware name: Dell Inc. Latitude E7470/0T6HHJ, BIOS 1.11.3 11/09/2016
      task: ffff880219fe4740 task.stack: ffffc90005f98000
      RIP: 0010:gen8_ppgtt_insert_4lvl+0x1b/0x1e0 [i915]
      RSP: 0018:ffffc90005f9b8c8 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffff8802167d8000 RCX: 0000000000000001
      RDX: 00000000ffff7000 RSI: ffff880219f94140 RDI: ffff880228444000
      RBP: ffffc90005f9b948 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000080
      R13: 0000000000000001 R14: ffffc90005f9bcd7 R15: ffff88020c9a83c0
      FS:  00007fb53e1ee920(0000) GS:ffff88024dd00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000010 CR3: 000000022ef95000 CR4: 00000000003406e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
        ppgtt_bind_vma+0x40/0x50 [i915]
        i915_vma_bind+0xcb/0x1c0 [i915]
        __i915_vma_do_pin+0x6e/0xd0 [i915]
        i915_gem_execbuffer_reserve_vma+0x162/0x1d0 [i915]
        i915_gem_execbuffer_reserve+0x4fc/0x510 [i915]
        ? __kmalloc+0x134/0x250
        ? i915_gem_wait_for_error+0x25/0x100 [i915]
        ? i915_gem_wait_for_error+0x25/0x100 [i915]
        i915_gem_do_execbuffer+0x2df/0xa00 [i915]
        ? drm_malloc_gfp.clone.0+0x42/0x80 [i915]
        ? path_put+0x22/0x30
        ? __check_object_size+0x62/0x1f0
        ? terminate_walk+0x44/0x90
        i915_gem_execbuffer2+0x95/0x1e0 [i915]
        drm_ioctl+0x243/0x490
        ? handle_pte_fault+0x1d7/0x220
        ? i915_gem_do_execbuffer+0xa00/0xa00 [i915]
        ? handle_mm_fault+0x10d/0x2a0
        vfs_ioctl+0x18/0x30
        do_vfs_ioctl+0x14b/0x3f0
        SyS_ioctl+0x92/0xa0
        entry_SYSCALL_64_fastpath+0x1a/0xa9
      RIP: 0033:0x7fb53b4fcb77
      RSP: 002b:00007ffe0c572898 EFLAGS: 00003246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 00007fb53e17c038 RCX: 00007fb53b4fcb77
      RDX: 00007ffe0c572900 RSI: 0000000040406469 RDI: 000000000000000b
      RBP: 00007fb5376d67e0 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000028 R11: 0000000000003246 R12: 0000000000000000
      R13: 0000000000000000 R14: 000055eecb314d00 R15: 000055eecb315460
      Code: 0f 84 5d ff ff ff eb a2 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 58 0f 1f 44 00 00 31 c0 89 4d b0 <4c>
      8b 60 10 44 8b 70 0c 48 89 d0 4c 8b 2e 48 c1 e8 27 25 ff 01
      RIP: gen8_ppgtt_insert_4lvl+0x1b/0x1e0 [i915] RSP: ffffc90005f9b8c8
      CR2: 0000000000000010
      
      Recent gccs, such as 4.9, 6.3 or 7.2, do not generate the warning nor do
      they explode on use. If we manually create the struct using locals from
      the stack, this should eliminate this issue, and does not alter code
      generation with gcc-7.2.
      
      Fixes: 894ccebe ("drm/i915: Micro-optimise gen8_ppgtt_insert_entries()")
      Reported-by: NKelly French <kfrench@federalhill.net>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Kelly French <kfrench@federalhill.net>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171106211128.12538-1-chris@chris-wilson.co.ukTested-by: NKelly French <kfrench@federalhill.net>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      (cherry picked from commit 5684514b)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      423a8a94
    • T
      drm/i915: Reject unknown syncobj flags · 40a48845
      Tvrtko Ursulin 提交于
      We have to reject unknown flags for uAPI considerations, and also
      because the curent implementation limits their i915 storage space
      to two bits.
      
      v2: (Chris Wilson)
       * Fix fail in ABI check.
       * Added unknown flags and BUILD_BUG_ON.
      
      v3:
       * Use ARCH_KMALLOC_MINALIGN instead of alignof. (Chris Wilson)
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Fixes: cf6e7bac ("drm/i915: Add support for drm syncobjs")
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: intel-gfx@lists.freedesktop.org
      Cc: dri-devel@lists.freedesktop.org
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171031102326.9738-1-tvrtko.ursulin@linux.intel.com
      (cherry picked from commit ebcaa1ff)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      40a48845
  2. 04 11月, 2017 4 次提交
    • A
      Revert "x86/mm: Stop calling leave_mm() in idle code" · 67535736
      Andy Lutomirski 提交于
      This reverts commit 43858b4f.
      
      The reason I removed the leave_mm() calls in question is because the
      heuristic wasn't needed after that patch.  With the original version
      of my PCID series, we never flushed a "lazy cpu" (i.e. a CPU running
      kernel thread) due a flush on the loaded mm.
      
      Unfortunately, that caused architectural issues, so now I've
      reinstated these flushes on non-PCID systems in:
      
          commit b956575b ("x86/mm: Flush more aggressively in lazy TLB mode").
      
      That, in turn, gives us a power management and occasionally
      performance regression as compared to old kernels: a process that
      goes into a deep idle state on a given CPU and gets its mm flushed
      due to activity on a different CPU will wake the idle CPU.
      
      Reinstate the old ugly heuristic: if a CPU goes into ACPI C3 or an
      intel_idle state that is likely to cause a TLB flush gets its mm
      switched to init_mm before going idle.
      
      FWIW, this heuristic is lousy.  Whether we should change CR3 before
      idle isn't a good hint except insofar as the performance hit is a bit
      lower if the TLB is getting flushed by the idle code anyway.  What we
      really want to know is whether we anticipate being idle long enough
      that the mm is likely to be flushed before we wake up.  This is more a
      matter of the expected latency than the idle state that gets chosen.
      This heuristic also completely fails on systems that don't know
      whether the TLB will be flushed (e.g. AMD systems?).  OTOH it may be a
      bit obsolete anyway -- PCID systems don't presently benefit from this
      heuristic at all.
      
      We also shouldn't do this callback from innermost bit of the idle code
      due to the RCU nastiness it causes.  All the information need is
      available before rcu_idle_enter() needs to happen.
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Borislav Petkov <bpetkov@suse.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 43858b4f "x86/mm: Stop calling leave_mm() in idle code"
      Link: http://lkml.kernel.org/r/c513bbd4e653747213e05bc7062de000bf0202a5.1509793738.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      67535736
    • S
      Input: sparse-keymap - send sync event for KE_SW/KE_VSW · 6f29c244
      Stefan Brüns 提交于
      Sync events are sent by sparse_keymap_report_entry for normal KEY_*
      events, and are generated by several drivers after generating
      SW_* events, so sparse_keymap_report_entry should do the same.
      
      Without the sync, events are accumulated in the kernel.
      
      Currently, no driver uses sparse-keymap for SW_* events, but
      it is required for the intel-vbtn platform driver to generate
      SW_TABLET_MODE events.
      Signed-off-by: NStefan Brüns <stefan.bruens@rwth-aachen.de>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      6f29c244
    • M
      Input: ar1021_i2c - set INPUT_PROP_DIRECT · 53f0b7f0
      Martin Kepplinger 提交于
      If INPUT_PROP_DIRECT is set, userspace doesn't have to fall back to old
      ways of identifying touchscreen devices. Let's add it.
      Signed-off-by: NMartin Kepplinger <martink@posteo.de>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      53f0b7f0
    • P
      Update MIPS email addresses · fb615d61
      Paul Burton 提交于
      MIPS will soon not be a part of Imagination Technologies, and as such
      many @imgtec.com email addresses will no longer be valid. This patch
      updates the addresses for those who:
      
       - Have 10 or more patches in mainline authored using an @imgtec.com
         email address, or any patches dated within the past year.
      
       - Are still with Imagination but leaving as part of the MIPS business
         unit, as determined from an internal email address list.
      
       - Haven't already updated their email address (ie. JamesH) or expressed
         a desire to be excluded (ie. Maciej).
      
       - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
         myself.
      
      New addresses are of the form firstname.lastname@mips.com, and all
      verified against an internal email address list.  An entry is added to
      .mailmap for each person such that get_maintainer.pl will report the new
      addresses rather than @imgtec.com addresses which will soon be dead.
      
      Instances of the affected addresses throughout the tree are then
      mechanically replaced with the new @mips.com address.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Acked-by: NDengcheng Zhu <dengcheng.zhu@mips.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Acked-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fb615d61
  3. 03 11月, 2017 2 次提交
  4. 02 11月, 2017 5 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
    • J
      net: vrf: correct FRA_L3MDEV encode type · 18129a24
      Jeff Barnhill 提交于
      FRA_L3MDEV is defined as U8, but is being added as a U32 attribute. On
      big endian architecture, this results in the l3mdev entry not being
      added to the FIB rules.
      
      Fixes: 1aa6c4f6 ("net: vrf: Add l3mdev rules on first device create")
      Signed-off-by: NJeff Barnhill <0xeffeff@gmail.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      18129a24
    • L
      drm/amdgpu: allow harvesting check for Polaris VCE · 32bec2af
      Leo Liu 提交于
      Fixes init failures on Polaris cards with harvested
      VCE blocks.
      Signed-off-by: NLeo Liu <leo.liu@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      32bec2af
    • L
      drm/amdgpu: return -ENOENT from uvd 6.0 early init for harvesting · cb4b02d7
      Leo Liu 提交于
      Fixes init failures on polaris cards with harvested UVD.
      Signed-off-by: NLeo Liu <leo.liu@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      cb4b02d7
    • C
      drm/i915: Check incoming alignment for unfenced buffers (on i915gm) · bb5cf338
      Chris Wilson 提交于
      In case the object has changed tiling between calls to execbuf, we need
      to check if the existing offset inside the GTT matches the new tiling
      constraint. We even need to do this for "unfenced" tiled objects, where
      the 3D commands use an implied fence and so the object still needs to
      match the physical fence restrictions on alignment (only required for
      gen2 and early gen3).
      
      In commit 2889caa9 ("drm/i915: Eliminate lots of iterations over
      the execobjects array"), the idea was to remove the second guessing and
      only set the NEEDS_MAP flag when required. However, the entire check
      for an unusable offset for fencing was removed and not just the
      secondary check. I.e.
      
      	/* avoid costly ping-pong once a batch bo ended up non-mappable */
              if (entry->flags & __EXEC_OBJECT_NEEDS_MAP &&
                  !i915_vma_is_map_and_fenceable(vma))
                      return !only_mappable_for_reloc(entry->flags);
      
      was entirely removed as the ping-pong between execbuf passes was fixed,
      but its primary purpose in forcing unaligned unfenced access to be
      rebound was forgotten.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103502
      Fixes: 2889caa9 ("drm/i915: Eliminate lots of iterations over the execobjects array")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171031103607.17836-1-chris@chris-wilson.co.ukReviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      (cherry picked from commit 1d033beb)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      bb5cf338
  5. 01 11月, 2017 13 次提交
    • H
      ide:ide-cd: fix kernel panic resulting from missing scsi_req_init · 79d73346
      Hongxu Jia 提交于
      Since we split the scsi_request out of struct request, while the
      standard prep_rq_fn builds 10 byte cmds, it missed to invoke
      scsi_req_init() to initialize certain fields of a scsi_request
      structure (.__cmd[], .cmd, .cmd_len and .sense_len but no other
      members of struct scsi_request).
      
      An example panic on virtual machines (qemu/virtualbox) to boot
      from IDE cdrom:
      ...
      [    8.754381] Call Trace:
      [    8.755419]  blk_peek_request+0x182/0x2e0
      [    8.755863]  blk_fetch_request+0x1c/0x40
      [    8.756148]  ? ktime_get+0x40/0xa0
      [    8.756385]  do_ide_request+0x37d/0x660
      [    8.756704]  ? cfq_group_service_tree_add+0x98/0xc0
      [    8.757011]  ? cfq_service_tree_add+0x1e5/0x2c0
      [    8.757313]  ? ktime_get+0x40/0xa0
      [    8.757544]  __blk_run_queue+0x3d/0x60
      [    8.757837]  queue_unplugged+0x2f/0xc0
      [    8.758088]  blk_flush_plug_list+0x1f4/0x240
      [    8.758362]  blk_finish_plug+0x2c/0x40
      ...
      [    8.770906] RIP: ide_cdrom_prep_fn+0x63/0x180 RSP: ffff92aec018bae8
      [    8.772329] ---[ end trace 6408481e551a85c9 ]---
      ...
      
      Fixes: 82ed4db4 ("block: split scsi_request out of struct request")
      Signed-off-by: NHongxu Jia <hongxu.jia@windriver.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      79d73346
    • D
      mmc: dw_mmc: Fix the DTO timeout calculation · 9d9491a7
      Douglas Anderson 提交于
      Just like the CTO timeout calculation introduced recently, the DTO
      timeout calculation was incorrect.  It used "bus_hz" but, as far as I
      can tell, it's supposed to use the card clock.  Let's account for the
      div value, which is documented as 2x the value stored in the register,
      or 1 if the register is 0.
      
      NOTE: This was likely not terribly important until commit 16a34574
      ("mmc: dw_mmc: remove the quirks flags") landed because "DIV" is
      documented on Rockchip SoCs (the ones that used to define the quirk)
      to always be 0 or 1.  ...and, in fact, it's documented to only be 1
      with EMMC in 8-bit DDR52 mode.  Thus before the quirk was applied to
      everyone it was mostly OK to ignore the DIV value.
      
      I haven't personally observed any problems that are fixed by this
      patch but I also haven't tested this anywhere with a DIV other an 0.
      AKA: this problem was found simply by code inspection and I have no
      failing test cases that are fixed by it.  Presumably this could fix
      real bugs for someone out there, though.
      
      Fixes: 16a34574 ("mmc: dw_mmc: remove the quirks flags")
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      9d9491a7
    • C
      tun/tap: sanitize TUNSETSNDBUF input · 93161922
      Craig Gallek 提交于
      Syzkaller found several variants of the lockup below by setting negative
      values with the TUNSETSNDBUF ioctl.  This patch adds a sanity check
      to both the tun and tap versions of this ioctl.
      
        watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [repro:2389]
        Modules linked in:
        irq event stamp: 329692056
        hardirqs last  enabled at (329692055): [<ffffffff824b8381>] _raw_spin_unlock_irqrestore+0x31/0x75
        hardirqs last disabled at (329692056): [<ffffffff824b9e58>] apic_timer_interrupt+0x98/0xb0
        softirqs last  enabled at (35659740): [<ffffffff824bc958>] __do_softirq+0x328/0x48c
        softirqs last disabled at (35659731): [<ffffffff811c796c>] irq_exit+0xbc/0xd0
        CPU: 0 PID: 2389 Comm: repro Not tainted 4.14.0-rc7 #23
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
        task: ffff880009452140 task.stack: ffff880006a20000
        RIP: 0010:_raw_spin_lock_irqsave+0x11/0x80
        RSP: 0018:ffff880006a27c50 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff10
        RAX: ffff880009ac68d0 RBX: ffff880006a27ce0 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffff880006a27ce0 RDI: ffff880009ac6900
        RBP: ffff880006a27c60 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000001 R11: 000000000063ff00 R12: ffff880009ac6900
        R13: ffff880006a27cf8 R14: 0000000000000001 R15: ffff880006a27cf8
        FS:  00007f4be4838700(0000) GS:ffff88000cc00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000020101000 CR3: 0000000009616000 CR4: 00000000000006f0
        Call Trace:
         prepare_to_wait+0x26/0xc0
         sock_alloc_send_pskb+0x14e/0x270
         ? remove_wait_queue+0x60/0x60
         tun_get_user+0x2cc/0x19d0
         ? __tun_get+0x60/0x1b0
         tun_chr_write_iter+0x57/0x86
         __vfs_write+0x156/0x1e0
         vfs_write+0xf7/0x230
         SyS_write+0x57/0xd0
         entry_SYSCALL_64_fastpath+0x1f/0xbe
        RIP: 0033:0x7f4be4356df9
        RSP: 002b:00007ffc18101c08 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
        RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f4be4356df9
        RDX: 0000000000000046 RSI: 0000000020101000 RDI: 0000000000000005
        RBP: 00007ffc18101c40 R08: 0000000000000001 R09: 0000000000000001
        R10: 0000000000000001 R11: 0000000000000293 R12: 0000559c75f64780
        R13: 00007ffc18101d30 R14: 0000000000000000 R15: 0000000000000000
      
      Fixes: 33dccbb0 ("tun: Limit amount of queued packets per device")
      Fixes: 20d29d7a ("net: macvtap driver")
      Signed-off-by: NCraig Gallek <kraig@google.com>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      93161922
    • V
      mlxsw: i2c: Fix buffer increment counter for write transaction · d70eaa38
      Vadim Pasternak 提交于
      It fixes a problem for the last chunk where 'chunk_size' is smaller than
      MLXSW_I2C_BLK_MAX and data is copied to the wrong offset, overriding
      previous data.
      
      Fixes: 6882b0ae ("mlxsw: Introduce support for I2C bus")
      Signed-off-by: NVadim Pasternak <vadimp@mellanox.com>
      Reviewed-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d70eaa38
    • I
      mlxsw: reg: Add high and low temperature thresholds · 62b0e924
      Ido Schimmel 提交于
      The ASIC has the ability to generate events whenever a sensor indicates
      the temperature goes above or below its high or low thresholds,
      respectively.
      
      In new firmware versions the firmware enforces a minimum of 5
      degrees Celsius difference between both thresholds. Make the driver
      conform to this requirement.
      
      Note that this is required even when the events are disabled, as in
      certain systems interrupts are generated via GPIO based on these
      thresholds.
      
      Fixes: 85926f87 ("mlxsw: reg: Add definition of temperature management registers")
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62b0e924
    • P
      net: hns: set correct return value · d2083d0e
      Pan Bian 提交于
      The function of_parse_phandle() returns a NULL pointer if it cannot
      resolve a phandle property to a device_node pointer. In function
      hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
      the error code. However, in this case, the extracted error code will
      always be zero, which is unexpected.
      Signed-off-by: NPan Bian <bianpan2016@163.com>
      Reviewed-by: NTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d2083d0e
    • P
      net: lapbether: fix double free · 7db8874a
      Pan Bian 提交于
      The function netdev_priv() returns the private data of the device. The
      memory to store the private data is allocated in alloc_netdev() and is
      released in netdev_free(). Calling kfree() on the return value of
      netdev_priv() after netdev_free() results in a double free bug.
      Signed-off-by: NPan Bian <bianpan2016@163.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7db8874a
    • A
      net: phy: marvell: Only configure RGMII delays when using RGMII · 14fc0aba
      Andrew Lunn 提交于
      The fix 5987feb3 ("net: phy: marvell: logical vs bitwise OR typo")
      uncovered another bug in the Marvell PHY driver, which broke the
      Marvell OpenRD platform. It relies on the bootloader configuring the
      RGMII delays and does not specify a phy-mode in its device tree.  The
      PHY driver should only configure RGMII delays if the phy mode
      indicates it is using RGMII. Without anything in device tree, the
      mv643xx Ethernet driver defaults to GMII.
      
      Fixes: 5987feb3 ("net: phy: marvell: logical vs bitwise OR typo")
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Tested-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      14fc0aba
    • A
      irqchip/irq-mvebu-gicp: Add missing spin_lock init · c9bb8633
      Antoine Tenart 提交于
      A spin lock is used in the irq-mvebu-gicp driver, but it is never
      initialized. This patch adds the missing spin_lock_init() call in the
      driver's probe function.
      
      Fixes: a68a63cb ("irqchip/irq-mvebu-gicp: Add new driver for Marvell GICP")
      Signed-off-by: NAntoine Tenart <antoine.tenart@free-electrons.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: gregory.clement@free-electrons.com
      Acked-by: marc.zyngier@arm.com
      Cc: thomas.petazzoni@free-electrons.com
      Cc: andrew@lunn.ch
      Cc: jason@lakedaemon.net
      Cc: nadavh@marvell.com
      Cc: miquel.raynal@free-electrons.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: sebastian.hesselbarth@gmail.com
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20171025072326.21030-1-antoine.tenart@free-electrons.com
      c9bb8633
    • B
      drm/nouveau/kms/nv50: use the correct state for base channel notifier setup · d324c5bc
      Ben Skeggs 提交于
      Fixes: 857263 ("drm/nouveau: Handle drm_atomic_helper_swap_state failure")
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      Tested-by: NLyude Paul <lyude@redhat.com>
      Reviewed by: Lyude Paul <lyude@redhat.com>
      d324c5bc
    • P
      Update MIPS email addresses · 48c834be
      Paul Burton 提交于
      MIPS will soon not be a part of Imagination Technologies, and as such
      many @imgtec.com email addresses will no longer be valid. This patch
      updates the addresses for those who:
      
       - Have 10 or more patches in mainline authored using an @imgtec.com
         email address, or any patches dated within the past year.
      
       - Are still with Imagination but leaving as part of the MIPS business
         unit, as determined from an internal email address list.
      
       - Haven't already updated their email address (ie. JamesH) or expressed
         a desire to be excluded (ie. Maciej).
      
       - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
         myself.
      
      New addresses are of the form firstname.lastname@mips.com, and all
      verified against an internal email address list. An entry is added to
      .mailmap for each person such that get_maintainer.pl will report the new
      addresses rather than @imgtec.com addresses which will soon be dead.
      
      Instances of the affected addresses throughout the tree are then
      mechanically replaced with the new @mips.com address.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Acked-by: NDengcheng Zhu <dengcheng.zhu@mips.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Acked-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17540/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      48c834be
    • L
      RDMA/nldev: Enforce device index check for port callback · 287683d0
      Leon Romanovsky 提交于
      IB device index is nldev's handler and it should be checked always.
      
      Fixes: c3f66f7b ("RDMA/netlink: Implement nldev port doit callback")
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Acked-by: NDoug Ledford <dledford@redhat.com>
      [ Applying directly, since Doug fried his SSD's and is rebuilding  - Linus ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      287683d0
    • R
      Revert "PM / QoS: Fix device resume latency PM QoS" · d5919dcc
      Rafael J. Wysocki 提交于
      This reverts commit 0cc2b4e5 (PM / QoS: Fix device resume latency PM
      QoS) as it introduced regressions on multiple systems and the fix-up
      in commit 2a9a86d5 (PM / QoS: Fix default runtime_pm device resume
      latency) does not address all of them.
      
      The original problem that commit 0cc2b4e5 was attempting to fix
      will be addressed later.
      
      Fixes: 0cc2b4e5 (PM / QoS: Fix device resume latency PM QoS)
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d5919dcc
  6. 31 10月, 2017 6 次提交
    • D
      scsi: qla2xxx: Fix oops in qla2x00_probe_one error path · e2532b4a
      Douglas Miller 提交于
      On error, kthread_create() returns an errno-encoded pointer, not NULL.
      The routine qla2x00_probe_one() detects the error case and jumps to
      probe_failed, but has already assigned the return value from
      kthread_create() to ha->dpc_thread.  Then probe_failed checks to see if
      ha->dpc_thread is not NULL before doing cleanup on it. Since in the
      error case this is also not NULL, it ends up trying to access an invalid
      task pointer.
      
      Solution is to assign NULL to ha->dpc_thread in the error path to avoid
      kthread cleanup in that case.
      Signed-off-by: NDouglas Miller <dougmill@linux.vnet.ibm.com>
      Acked-by: NHimanshu Madhani <himanshu.madhani@cavium.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      e2532b4a
    • C
      drm/i915: Hold rcu_read_lock when iterating over the radixtree (vma idr) · dc35b112
      Chris Wilson 提交于
      Kasan spotted
      
          [IGT] gem_tiled_pread_pwrite: exiting, ret=0
          ==================================================================
          BUG: KASAN: use-after-free in __i915_gem_object_reset_page_iter+0x15c/0x170 [i915]
          Read of size 8 at addr ffff8801359da310 by task kworker/3:2/182
      
          CPU: 3 PID: 182 Comm: kworker/3:2 Tainted: G     U          4.14.0-rc6-CI-Custom_3340+ #1
          Hardware name: Intel Corp. Geminilake/GLK RVP1 DDR4 (05), BIOS GELKRVPA.X64.0062.B30.1708222146 08/22/2017
          Workqueue: events __i915_gem_free_work [i915]
          Call Trace:
           dump_stack+0x68/0xa0
           print_address_description+0x78/0x290
           ? __i915_gem_object_reset_page_iter+0x15c/0x170 [i915]
           kasan_report+0x23d/0x350
           __asan_report_load8_noabort+0x19/0x20
           __i915_gem_object_reset_page_iter+0x15c/0x170 [i915]
           ? i915_gem_object_truncate+0x100/0x100 [i915]
           ? lock_acquire+0x380/0x380
           __i915_gem_object_put_pages+0x30d/0x530 [i915]
           __i915_gem_free_objects+0x551/0xbd0 [i915]
           ? lock_acquire+0x13e/0x380
           __i915_gem_free_work+0x4e/0x70 [i915]
           process_one_work+0x6f6/0x1590
           ? pwq_dec_nr_in_flight+0x2b0/0x2b0
           worker_thread+0xe6/0xe90
           ? pci_mmcfg_check_reserved+0x110/0x110
           kthread+0x309/0x410
           ? process_one_work+0x1590/0x1590
           ? kthread_create_on_node+0xb0/0xb0
           ret_from_fork+0x27/0x40
      
          Allocated by task 1801:
           save_stack_trace+0x1b/0x20
           kasan_kmalloc+0xee/0x190
           kasan_slab_alloc+0x12/0x20
           kmem_cache_alloc+0xdc/0x2e0
           radix_tree_node_alloc.constprop.12+0x48/0x330
           __radix_tree_create+0x274/0x480
           __radix_tree_insert+0xa2/0x610
           i915_gem_object_get_sg+0x224/0x670 [i915]
           i915_gem_object_get_page+0xb5/0x1c0 [i915]
           i915_gem_pread_ioctl+0x822/0xf60 [i915]
           drm_ioctl_kernel+0x13f/0x1c0
           drm_ioctl+0x6cf/0x980
           do_vfs_ioctl+0x184/0xf30
           SyS_ioctl+0x41/0x70
           entry_SYSCALL_64_fastpath+0x1c/0xb1
      
          Freed by task 37:
           save_stack_trace+0x1b/0x20
           kasan_slab_free+0xaf/0x190
           kmem_cache_free+0xbf/0x340
           radix_tree_node_rcu_free+0x79/0x90
           rcu_process_callbacks+0x46d/0xf40
           __do_softirq+0x21c/0x8d3
      
          The buggy address belongs to the object at ffff8801359da0f0
          which belongs to the cache radix_tree_node of size 576
          The buggy address is located 544 bytes inside of
          576-byte region [ffff8801359da0f0, ffff8801359da330)
          The buggy address belongs to the page:
          page:ffffea0004d67600 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
          flags: 0x8000000000008100(slab|head)
          raw: 8000000000008100 0000000000000000 0000000000000000 0000000100110011
          raw: ffffea0004b52920 ffffea0004b38020 ffff88015b416a80 0000000000000000
          page dumped because: kasan: bad access detected
      
          Memory state around the buggy address:
           ffff8801359da200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
           ffff8801359da280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
          >ffff8801359da300: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
      			     ^
           ffff8801359da380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
           ffff8801359da400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
          ==================================================================
          Disabling lock debugging due to kernel taint
      
      which looks like the slab containing the radixtree iter was freed as we
      traversed the tree, taking the rcu read lock across the loop should
      prevent that (deferring all the frees until the end).
      Reported-by: NTomi Sarvela <tomi.p.sarvela@intel.com>
      Fixes: d1b48c1e ("drm/i915: Replace execbuf vma ht with an idr")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171026130032.10677-2-chris@chris-wilson.co.ukReviewed-by: NMatthew Auld <matthew.william.auld@gmail.com>
      (cherry picked from commit 547da76b)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      dc35b112
    • C
      drm/i915: Hold rcu_read_lock when iterating over the radixtree (objects) · 23e87338
      Chris Wilson 提交于
      Kasan spotted
      
          [IGT] gem_tiled_pread_pwrite: exiting, ret=0
          ==================================================================
          BUG: KASAN: use-after-free in __i915_gem_object_reset_page_iter+0x15c/0x170 [i915]
          Read of size 8 at addr ffff8801359da310 by task kworker/3:2/182
      
          CPU: 3 PID: 182 Comm: kworker/3:2 Tainted: G     U          4.14.0-rc6-CI-Custom_3340+ #1
          Hardware name: Intel Corp. Geminilake/GLK RVP1 DDR4 (05), BIOS GELKRVPA.X64.0062.B30.1708222146 08/22/2017
          Workqueue: events __i915_gem_free_work [i915]
          Call Trace:
           dump_stack+0x68/0xa0
           print_address_description+0x78/0x290
           ? __i915_gem_object_reset_page_iter+0x15c/0x170 [i915]
           kasan_report+0x23d/0x350
           __asan_report_load8_noabort+0x19/0x20
           __i915_gem_object_reset_page_iter+0x15c/0x170 [i915]
           ? i915_gem_object_truncate+0x100/0x100 [i915]
           ? lock_acquire+0x380/0x380
           __i915_gem_object_put_pages+0x30d/0x530 [i915]
           __i915_gem_free_objects+0x551/0xbd0 [i915]
           ? lock_acquire+0x13e/0x380
           __i915_gem_free_work+0x4e/0x70 [i915]
           process_one_work+0x6f6/0x1590
           ? pwq_dec_nr_in_flight+0x2b0/0x2b0
           worker_thread+0xe6/0xe90
           ? pci_mmcfg_check_reserved+0x110/0x110
           kthread+0x309/0x410
           ? process_one_work+0x1590/0x1590
           ? kthread_create_on_node+0xb0/0xb0
           ret_from_fork+0x27/0x40
      
          Allocated by task 1801:
           save_stack_trace+0x1b/0x20
           kasan_kmalloc+0xee/0x190
           kasan_slab_alloc+0x12/0x20
           kmem_cache_alloc+0xdc/0x2e0
           radix_tree_node_alloc.constprop.12+0x48/0x330
           __radix_tree_create+0x274/0x480
           __radix_tree_insert+0xa2/0x610
           i915_gem_object_get_sg+0x224/0x670 [i915]
           i915_gem_object_get_page+0xb5/0x1c0 [i915]
           i915_gem_pread_ioctl+0x822/0xf60 [i915]
           drm_ioctl_kernel+0x13f/0x1c0
           drm_ioctl+0x6cf/0x980
           do_vfs_ioctl+0x184/0xf30
           SyS_ioctl+0x41/0x70
           entry_SYSCALL_64_fastpath+0x1c/0xb1
      
          Freed by task 37:
           save_stack_trace+0x1b/0x20
           kasan_slab_free+0xaf/0x190
           kmem_cache_free+0xbf/0x340
           radix_tree_node_rcu_free+0x79/0x90
           rcu_process_callbacks+0x46d/0xf40
           __do_softirq+0x21c/0x8d3
      
          The buggy address belongs to the object at ffff8801359da0f0
          which belongs to the cache radix_tree_node of size 576
          The buggy address is located 544 bytes inside of
          576-byte region [ffff8801359da0f0, ffff8801359da330)
          The buggy address belongs to the page:
          page:ffffea0004d67600 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
          flags: 0x8000000000008100(slab|head)
          raw: 8000000000008100 0000000000000000 0000000000000000 0000000100110011
          raw: ffffea0004b52920 ffffea0004b38020 ffff88015b416a80 0000000000000000
          page dumped because: kasan: bad access detected
      
          Memory state around the buggy address:
           ffff8801359da200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
           ffff8801359da280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
          >ffff8801359da300: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
      			     ^
           ffff8801359da380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
           ffff8801359da400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
          ==================================================================
          Disabling lock debugging due to kernel taint
      
      which looks like the slab containing the radixtree iter was freed as we
      traversed the tree, taking the rcu read lock across the loop should
      prevent that (deferring all the frees until the end).
      Reported-by: NTomi Sarvela <tomi.p.sarvela@intel.com>
      Fixes: 96d77634 ("drm/i915: Use a radixtree for random access to the object's backing storage")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171026130032.10677-1-chris@chris-wilson.co.ukReviewed-by: NMatthew Auld <matthew.william.auld@gmail.com>
      (cherry picked from commit bea6e987)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      23e87338
    • J
      drm/i915/edp: read edp display control registers unconditionally · 7c838e2a
      Jani Nikula 提交于
      Per my reading of the eDP spec, DP_DPCD_DISPLAY_CONTROL_CAPABLE bit in
      DP_EDP_CONFIGURATION_CAP should be set if the eDP display control
      registers starting at offset DP_EDP_DPCD_REV are "enabled". Currently we
      check the bit before reading the registers, and DP_EDP_DPCD_REV is the
      only way to detect eDP revision.
      
      Turns out there are (likely buggy) displays that require eDP 1.4+
      features, such as supported link rates and link rate select, but do not
      have the bit set. Read the display control registers
      unconditionally. They are supposed to read zero anyway if they are not
      supported, so there should be no harm in this.
      
      This fixes the referenced bug by enabling the eDP version check, and
      thus reading of the supported link rates. The panel in question has 0 in
      DP_MAX_LINK_RATE which is only supported in eDP 1.4+. Without the
      supported link rates method we default to RBR which is insufficient for
      the panel native mode. As a curiosity, the panel also has a bogus value
      of 0x12 in DP_EDP_DPCD_REV, but that passes our check for >= DP_EDP_14
      (which is 0x03).
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103400Reported-and-tested-by: NNicolas P. <issun.artiste@gmail.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NManasi Navare <manasi.d.navare@intel.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171026142932.17737-1-jani.nikula@intel.com
      (cherry picked from commit 0501a3b0)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      7c838e2a
    • M
      drm/i915: Do not rely on wm preservation for ILK watermarks · 8777b927
      Maarten Lankhorst 提交于
      The original intent was to preserve watermarks as much as possible
      in intel_pipe_wm.raw_wm, and put the validated ones in intel_pipe_wm.wm.
      
      It seems this approach is insufficient and we don't always preserve
      the raw watermarks, so just use the atomic iterator we're already using
      to get a const pointer to all bound planes on the crtc.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102373Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: stable@vger.kernel.org #v4.8+
      Acked-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171019151341.4579-1-maarten.lankhorst@linux.intel.com
      (cherry picked from commit 28283f4f)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      8777b927
    • M
      drm/i915: Cancel the modeset retry work during modeset cleanup · 713946d1
      Manasi Navare 提交于
      During modeset cleanup on driver unload we may have a pending
      hotplug work. This needs to be canceled early during the teardown
      so that it does not fire after we have freed the connector.
      We do this after drm_kms_helper_poll_fini(dev) since this might
      trigger modeset retry work due to link retrain and before
      intel_fbdev_fini() since this work requires the lock from fbdev.
      
      If this is not done we may see something like:
      DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock))
       ------------[ cut here ]------------
       WARNING: CPU: 4 PID: 5010 at kernel/locking/mutex-debug.c:103 mutex_destroy+0x4e/0x60
       Modules linked in: i915(-) snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec snd_hwdep snd_hda_core snd_pcm vgem ax88179_178
      +a usbnet mii x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel e1000e ptp pps_core prime_numbers i2c_hid
      +[last unloaded: snd_hda_intel]
       CPU: 4 PID: 5010 Comm: drv_module_relo Tainted: G     U          4.14.0-rc3-CI-CI_DRM_3186+ #1
       Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWX1.R00.X104.A03.1709140524 09/14/2017
       task: ffff8803c827aa40 task.stack: ffffc90000520000
       RIP: 0010:mutex_destroy+0x4e/0x60
       RSP: 0018:ffffc90000523d58 EFLAGS: 00010292
       RAX: 000000000000002a RBX: ffff88044fbef648 RCX: 0000000000000000
       RDX: 0000000080000001 RSI: 0000000000000001 RDI: ffffffff810f0cf0
       RBP: ffffc90000523d60 R08: 0000000000000001 R09: 0000000000000001
       R10: 000000000f21cb81 R11: 0000000000000000 R12: ffff88044f71efc8
       R13: ffffffffa02b3d20 R14: ffffffffa02b3d90 R15: ffff880459b29308
       FS:  00007f5df4d6e8c0(0000) GS:ffff88045d300000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 000055ec51f00a18 CR3: 0000000451782006 CR4: 00000000003606e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        drm_fb_helper_fini+0xd9/0x130
        intel_fbdev_destroy+0x12/0x60 [i915]
        intel_fbdev_fini+0x28/0x30 [i915]
        intel_modeset_cleanup+0x45/0xa0 [i915]
        i915_driver_unload+0x92/0x180 [i915]
        i915_pci_remove+0x19/0x30 [i915]
        i915_driver_unload+0x92/0x180 [i915]
        i915_pci_remove+0x19/0x30 [i915]
        pci_device_remove+0x39/0xb0
        device_release_driver_internal+0x15d/0x220
        driver_detach+0x40/0x80
        bus_remove_driver+0x58/0xd0
        driver_unregister+0x2c/0x40
        pci_unregister_driver+0x36/0xb0
        i915_exit+0x1a/0x8b [i915]
        SyS_delete_module+0x18c/0x1e0
        entry_SYSCALL_64_fastpath+0x1c/0xb1
       RIP: 0033:0x7f5df3286287
       RSP: 002b:00007fff8e107cc8 EFLAGS: 00000246 ORIG_RAX: 00000000000000b0
       RAX: ffffffffffffffda RBX: ffffffff81493a03 RCX: 00007f5df3286287
       RDX: 0000000000000001 RSI: 0000000000000800 RDI: 0000564c7be02e48
       RBP: ffffc90000523f88 R08: 0000000000000000 R09: 0000000000000080
       R10: 00007f5df4d6e8c0 R11: 0000000000000246 R12: 0000000000000000
       R13: 00007fff8e107eb0 R14: 0000000000000000 R15: 0000000000000000
      Or a GPF like:
      
       general protection fault: 0000 [#1] PREEMPT SMP
       Modules linked in: i915(-) snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec snd_hwdep snd_hda_core snd_pcm vgem ax88179_178
      +a usbnet mii x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel e1000e ptp pps_core prime_numbers i2c_hid
      +[last unloaded: snd_hda_intel]
       CPU: 0 PID: 82 Comm: kworker/0:1 Tainted: G     U  W       4.14.0-rc3-CI-CI_DRM_3186+ #1
       Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake S UDIMM RVP, BIOS CNLSFWX1.R00.X104.A03.1709140524 09/14/2017
       Workqueue: events intel_dp_modeset_retry_work_fn [i915]
       task: ffff88045a5caa40 task.stack: ffffc90000378000
       RIP: 0010:drm_setup_crtcs+0x143/0xbf0
       RSP: 0018:ffffc9000037bd20 EFLAGS: 00010202
       RAX: 6b6b6b6b6b6b6b6b RBX: 0000000000000002 RCX: 0000000000000001
       RDX: 0000000000000001 RSI: 0000000000000780 RDI: 00000000ffffffff
       RBP: ffffc9000037bdb8 R08: 0000000000000001 R09: 0000000000000001
       R10: 0000000000000780 R11: 0000000000000000 R12: 0000000000000002
       R13: ffff88044fbef4e8 R14: 0000000000000780 R15: 0000000000000438
       FS:  0000000000000000(0000) GS:ffff88045d200000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 000055ec51ee5168 CR3: 000000044c89d003 CR4: 00000000003606f0
       Call Trace:
        drm_fb_helper_hotplug_event.part.18+0x7e/0xc0
        drm_fb_helper_hotplug_event+0x1a/0x20
        intel_fbdev_output_poll_changed+0x1a/0x20 [i915]
        drm_kms_helper_hotplug_event+0x27/0x30
        intel_dp_modeset_retry_work_fn+0x77/0x80 [i915]
        process_one_work+0x233/0x660
        worker_thread+0x206/0x3b0
        kthread+0x152/0x190
        ? process_one_work+0x660/0x660
        ? kthread_create_on_node+0x40/0x40
        ret_from_fork+0x27/0x40
       Code: 06 00 00 45 8b 45 20 31 db 45 31 e4 45 85 c0 0f 8e 91 06 00 00 44 8b 75 94 44 8b 7d 90 49 8b 45 28 49 63 d4 44 89 f6 41 83 c4 01 <48> 8b 04 d0 44
      +89 fa 48 8b 38 48 8b 87 a8 01 00 00 ff 50 20 01
       RIP: drm_setup_crtcs+0x143/0xbf0 RSP: ffffc9000037bd20
       ---[ end trace 08901ff1a77d30c7 ]---
      
      v2:
      * Rename it to intel_hpd_poll_fini() and call drm_kms_helper_fini() inside it
      as the first step before cancel work (Chris Wilson)
      * Add GPF trace in commit message and make the function static (Maarten Lankhorst)
      Suggested-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Suggested-by: NChris Wilson <chris@chris-wilson.co.uk>
      Fixes: 9301397a ("drm/i915: Implement Link Rate fallback on Link training failure")
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Tony Cheng <tony.cheng@amd.com>
      Cc: Harry Wentland <Harry.wentland@amd.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
      Cc: Manasi Navare <manasi.d.navare@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NManasi Navare <manasi.d.navare@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1509054720-25325-1-git-send-email-manasi.d.navare@intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      (cherry picked from commit 886c6b86)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      713946d1
  7. 30 10月, 2017 6 次提交
    • K
      nvme: Fix setting logical block format when revalidating · 5e0fab57
      Keith Busch 提交于
      Revalidating the disk needs to set the logical block format and capacity,
      otherwise it can't figure out if the users modified anything about
      the namespace.
      
      Fixes: cdbff4f2 ("nvme: remove nvme_revalidate_ns")
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NKeith Busch <keith.busch@intel.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5e0fab57
    • D
      mmc: dw_mmc: Add locking to the CTO timer · 8892b705
      Douglas Anderson 提交于
      This attempts to instill a bit of paranoia to the code dealing with
      the CTO timer.  It's believed that this will make the CTO timer more
      robust in the case that we're having very long interrupt latencies.
      
      Note that I originally thought that perhaps this patch was being
      overly paranoid and wasn't really needed, but then while I was running
      mmc_test on an rk3399 board I saw one instance of the message:
        dwmmc_rockchip fe320000.dwmmc: Unexpected interrupt latency
      
      I had debug prints in the CTO timer code and I found that it was
      running CMD 13 at the time.
      
      ...so even though this patch seems like it might be overly paranoid,
      maybe it really isn't?
      
      Presumably the bad interrupt latency experienced was due to the fact
      that I had serial console enabled as serial console is typically where
      I place blame when I see absurdly large interrupt latencies.  In this
      particular case there was an (unrelated) printout to the serial
      console just before I saw the "Unexpected interrupt latency" printout.
      
      ...and actually, I managed to even reproduce the problems by running
      "iw mlan0 scan > /dev/null" while mmc_test was running.  That not only
      does a bunch of PCIe traffic but it also (on my system) outputs some
      SELinux log spam.
      
      Fixes: 03de1921 ("mmc: dw_mmc: introduce timer for broken command transfer over scheme")
      Tested-by: NEmil Renner Berthing <kernel@esmil.dk>
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      8892b705
    • D
      mmc: dw_mmc: Fix the CTO timeout calculation · 4c2357f5
      Douglas Anderson 提交于
      In the commit 03de1921 ("mmc: dw_mmc: introduce timer for broken
      command transfer over scheme") we tried to calculate the expected
      hardware command timeout value.  Unfortunately that calculation isn't
      quite correct in all cases.  It used "bus_hz" but, as far as I can
      tell, it's supposed to use the card clock.  Let's account for the div
      value, which is documented as 2x the value stored in the register, or
      1 if the register is 0.
      
      NOTE: It's not expected that this will actually fix anything important
      since the 10 ms margin added by the function will pretty much dwarf
      any calculations.  The card clock should be 100 kHz at minimum and:
        1000 ms/s * (255 * 2) / 100000 Hz.
      Gives us 5.1 ms.
      
      ...so really the point of this patch is just to make the code more
      "correct" in case anyone ever tries to remove the 10 ms buffer.
      
      Fixes: 03de1921 ("mmc: dw_mmc: introduce timer for broken command transfer over scheme")
      Tested-by: NEmil Renner Berthing <kernel@esmil.dk>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      4c2357f5
    • D
      mmc: dw_mmc: cancel the CTO timer after a voltage switch · 0363b12d
      Douglas Anderson 提交于
      When running with the commit 03de1921 ("mmc: dw_mmc: introduce
      timer for broken command transfer over scheme") I found this message
      in the log:
        Unexpected command timeout, state 7
      
      It turns out that we weren't properly cancelling the new CTO timer in
      the case that a voltage switch was done.  Let's promote the cancel
      into the dw_mci_cmd_interrupt() function to fix this.
      
      Fixes: 03de1921 ("mmc: dw_mmc: introduce timer for broken command transfer over scheme")
      Tested-by: NEmil Renner Berthing <kernel@esmil.dk>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      0363b12d
    • K
      Revert "ath10k: fix napi_poll budget overflow" · e48e9c42
      Kalle Valo 提交于
      Thorsten reported on <fa6e3ee2-91b5-a54b-afe3-87f30aac7a48@leemhuis.info> that
      commit c9353bf4 made ath10k unstable with QCA6174 on his Dell XPS13 (9360)
      with an error message:
      
      ath10k_pci 0000:3a:00.0: failed to extract amsdu: -11
      
      It only seemed to happen with certain APs, not all, but when it happened the
      only way to get ath10k working was to switch the wifi off and on with a hotkey.
      
      As this commit made things even worse (a warning vs breaking the whole
      connection) let's revert the commit for now and while the issue is being fixed.
      
      Link: http://lists.infradead.org/pipermail/ath10k/2017-October/010227.htmlReported-by: NThorsten Leemhuis <linux@leemhuis.info>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      e48e9c42
    • V
      ath10k: rebuild crypto header in rx data frames · 7eccb738
      Vasanthakumar Thiagarajan 提交于
      Rx data frames notified through HTT_T2H_MSG_TYPE_RX_IND and
      HTT_T2H_MSG_TYPE_RX_FRAG_IND expect PN/TSC check to be done
      on host (mac80211) rather than firmware. Rebuild cipher header
      in every received data frames (that are notified through those
      HTT interfaces) from the rx_hdr_status tlv available in the
      rx descriptor of the first msdu. Skip setting RX_FLAG_IV_STRIPPED
      flag for the packets which requires mac80211 PN/TSC check support
      and set appropriate RX_FLAG for stripped crypto tail. Hw QCA988X,
      QCA9887, QCA99X0, QCA9984, QCA9888 and QCA4019 currently need the
      rebuilding of cipher header to perform PN/TSC check for replay
      attack.
      
      Please note that removing crypto tail for CCMP-256, GCMP and GCMP-256 ciphers
      in raw mode needs to be fixed. Since Rx with these ciphers in raw
      mode does not work in the current form even without this patch and
      removing crypto tail for these chipers needs clean up, raw mode related
      issues in CCMP-256, GCMP and GCMP-256 can be addressed in follow up
      patches.
      Tested-by: NManikanta Pubbisetty <mpubbise@qti.qualcomm.com>
      Signed-off-by: NVasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
      Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
      7eccb738
  8. 28 10月, 2017 2 次提交
    • G
      tap: reference to KVA of an unloaded module causes kernel panic · dea6e19f
      Girish Moodalbail 提交于
      The commit 9a393b5d ("tap: tap as an independent module") created a
      separate tap module that implements tap functionality and exports
      interfaces that will be used by macvtap and ipvtap modules to create
      create respective tap devices.
      
      However, that patch introduced a regression wherein the modules macvtap
      and ipvtap can be removed (through modprobe -r) while there are
      applications using the respective /dev/tapX devices. These applications
      cause kernel to hold reference to /dev/tapX through 'struct cdev
      macvtap_cdev' and 'struct cdev ipvtap_dev' defined in macvtap and ipvtap
      modules respectively. So,  when the application is later closed the
      kernel panics because we are referencing KVA that is present in the
      unloaded modules.
      
      ----------8<------- Example ----------8<----------
      $ sudo ip li add name mv0 link enp7s0 type macvtap
      $ sudo ip li show mv0 |grep mv0| awk -e '{print $1 $2}'
        14:mv0@enp7s0:
      $ cat /dev/tap14 &
      $ lsmod |egrep -i 'tap|vlan'
      macvtap                16384  0
      macvlan                24576  1 macvtap
      tap                    24576  3 macvtap
      $ sudo modprobe -r macvtap
      $ fg
      cat /dev/tap14
      ^C
      
      <...system panics...>
      BUG: unable to handle kernel paging request at ffffffffa038c500
      IP: cdev_put+0xf/0x30
      ----------8<-----------------8<----------
      
      The fix is to set cdev.owner to the module that creates the tap device
      (either macvtap or ipvtap). With this set, the operations (in
      fs/char_dev.c) on char device holds and releases the module through
      cdev_get() and cdev_put() and will not allow the module to unload
      prematurely.
      
      Fixes: 9a393b5d (tap: tap as an independent module)
      Signed-off-by: NGirish Moodalbail <girish.moodalbail@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dea6e19f
    • J
      tuntap: properly align skb->head before building skb · 63b9ab65
      Jason Wang 提交于
      An unaligned alloc_frag->offset caused by previous allocation will
      result an unaligned skb->head. This will lead unaligned
      skb_shared_info and then unaligned dataref which requires to be
      aligned for accessing on some architecture. Fix this by aligning
      alloc_frag->offset before the frag refilling.
      
      Fixes: 0bbd7dad ("tun: make tun_build_skb() thread safe")
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
      Cc: Wei Wei <dotweiba@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Reported-by: NWei Wei <dotweiba@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63b9ab65