1. 01 12月, 2019 40 次提交
    • W
      x86/speculation: Fix redundant MDS mitigation message · ed7a3dde
      Waiman Long 提交于
      commit cd5a2aa89e847bdda7b62029d94e95488d73f6b2 upstream.
      
      Since MDS and TAA mitigations are inter-related for processors that are
      affected by both vulnerabilities, the followiing confusing messages can
      be printed in the kernel log:
      
        MDS: Vulnerable
        MDS: Mitigation: Clear CPU buffers
      
      To avoid the first incorrect message, defer the printing of MDS
      mitigation after the TAA mitigation selection has been done. However,
      that has the side effect of printing TAA mitigation first before MDS
      mitigation.
      
       [ bp: Check box is affected/mitigations are disabled first before
         printing and massage. ]
      Suggested-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Mark Gross <mgross@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191115161445.30809-3-longman@redhat.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed7a3dde
    • W
      x86/speculation: Fix incorrect MDS/TAA mitigation status · 0af5ae26
      Waiman Long 提交于
      commit 64870ed1b12e235cfca3f6c6da75b542c973ff78 upstream.
      
      For MDS vulnerable processors with TSX support, enabling either MDS or
      TAA mitigations will enable the use of VERW to flush internal processor
      buffers at the right code path. IOW, they are either both mitigated
      or both not. However, if the command line options are inconsistent,
      the vulnerabilites sysfs files may not report the mitigation status
      correctly.
      
      For example, with only the "mds=off" option:
      
        vulnerabilities/mds:Vulnerable; SMT vulnerable
        vulnerabilities/tsx_async_abort:Mitigation: Clear CPU buffers; SMT vulnerable
      
      The mds vulnerabilities file has wrong status in this case. Similarly,
      the taa vulnerability file will be wrong with mds mitigation on, but
      taa off.
      
      Change taa_select_mitigation() to sync up the two mitigation status
      and have them turned off if both "mds=off" and "tsx_async_abort=off"
      are present.
      
      Update documentation to emphasize the fact that both "mds=off" and
      "tsx_async_abort=off" have to be specified together for processors that
      are affected by both TAA and MDS to be effective.
      
       [ bp: Massage and add kernel-parameters.txt change too. ]
      
      Fixes: 1b42f017415b ("x86/speculation/taa: Add mitigation for TSX Async Abort")
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: linux-doc@vger.kernel.org
      Cc: Mark Gross <mgross@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Tyler Hicks <tyhicks@canonical.com>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191115161445.30809-2-longman@redhat.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0af5ae26
    • A
      x86/insn: Fix awk regexp warnings · ed731209
      Alexander Kapshuk 提交于
      commit 700c1018b86d0d4b3f1f2d459708c0cdf42b521d upstream.
      
      gawk 5.0.1 generates the following regexp warnings:
      
        GEN      /home/sasha/torvalds/tools/objtool/arch/x86/lib/inat-tables.c
        awk: ../arch/x86/tools/gen-insn-attr-x86.awk:260: warning: regexp escape sequence `\:' is not a known regexp operator
        awk: ../arch/x86/tools/gen-insn-attr-x86.awk:350: (FILENAME=../arch/x86/lib/x86-opcode-map.txt FNR=41) warning: regexp escape sequence `\&' is  not a known regexp operator
      
      Ealier versions of gawk are not known to generate these warnings. The
      gawk manual referenced below does not list characters ':' and '&' as
      needing escaping, so 'unescape' them. See
      
        https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences.html
      
      for more info.
      
      Running diff on the output generated by the script before and after
      applying the patch reported no differences.
      
       [ bp: Massage commit message. ]
      
      [ Caught the respective tools header discrepancy. ]
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NAlexander Kapshuk <alexander.kapshuk@gmail.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20190924044659.3785-1-alexander.kapshuk@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed731209
    • A
      ARC: perf: Accommodate big-endian CPU · 99b933bb
      Alexey Brodkin 提交于
      commit 5effc09c4907901f0e71e68e5f2e14211d9a203f upstream.
      
      8-letter strings representing ARC perf events are stores in two
      32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.
      
      And the same order of bytes in the word is used regardless CPU endianness.
      
      Which means in case of big-endian CPU core we need to swap bytes to get
      the same order as if it was on little-endian CPU.
      
      Otherwise we're seeing the following error message on boot:
      ------------------------->8----------------------
      ARC perf        : 8 counters (32 bits), 40 conditions, [overflow IRQ support]
      sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
      Stack Trace:
        arc_unwind_core+0xd4/0xfc
        dump_stack+0x64/0x80
        sysfs_warn_dup+0x46/0x58
        sysfs_add_file_mode_ns+0xb2/0x168
        create_files+0x70/0x2a0
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 perf_event_sysfs_init+0x70/0xa0
      Failed to register pmu: arc_pct, reason -17
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
      Stack Trace:
        arc_unwind_core+0xd4/0xfc
        dump_stack+0x64/0x80
        __warn+0x9c/0xd4
        warn_slowpath_fmt+0x22/0x2c
        perf_event_sysfs_init+0x70/0xa0
      ---[ end trace a75fb9a9837bd1ec ]---
      ------------------------->8----------------------
      
      What happens here we're trying to register more than one raw perf event
      with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters
      and encoded into two 32-bit words. In this particular case we deal with 2
      events:
       * "IJMP____" which counts all jump & branch instructions
       * "IJMPC___" which counts only conditional jumps & branches
      
      Those strings are split in two 32-bit words this way "IJMP" + "____" &
      "IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core
      being big-endian then we read "PMJI" + "____" & "PMJI" + "___C".
      
      And since we interpret read array of ASCII letters as a null-terminated string
      on big-endian CPU we end up with 2 events of the same name "PMJI".
      Signed-off-by: NAlexey Brodkin <abrodkin@synopsys.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      
      99b933bb
    • C
      ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary · e02f1448
      Chester Lin 提交于
      commit 1d31999cf04c21709f72ceb17e65b54a401330da upstream.
      
      adjust_lowmem_bounds() checks every memblocks in order to find the boundary
      between lowmem and highmem. However some memblocks could be marked as NOMAP
      so they are not used by kernel, which should be skipped while calculating
      the boundary.
      Signed-off-by: NChester Lin <clin@suse.com>
      Reviewed-by: NMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NLee Jones <lee.jones@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e02f1448
    • G
      ocfs2: remove ocfs2_is_o2cb_active() · 046f0fcf
      Gang He 提交于
      commit a634644751c46238df58bbfe992e30c1668388db upstream.
      
      Remove ocfs2_is_o2cb_active().  We have similar functions to identify
      which cluster stack is being used via osb->osb_cluster_stack.
      
      Secondly, the current implementation of ocfs2_is_o2cb_active() is not
      totally safe.  Based on the design of stackglue, we need to get
      ocfs2_stack_lock before using ocfs2_stack related data structures, and
      that active_stack pointer can be NULL in the case of mount failure.
      
      Link: http://lkml.kernel.org/r/1495441079-11708-1-git-send-email-ghe@suse.comSigned-off-by: NGang He <ghe@suse.com>
      Reviewed-by: NJoseph Qi <jiangqi903@gmail.com>
      Reviewed-by: NEric Ren <zren@suse.com>
      Acked-by: NChangwei Ge <ge.changwei@h3c.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NLee Jones <lee.jones@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      046f0fcf
    • M
      net: phy: dp83867: increase SGMII autoneg timer duration · 36bef080
      Max Uvarov 提交于
      commit 1a97a477e666cbdededab93bd3754e508f0c09d7 upstream.
      
      After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 are 01).
      That is not enough to finalize autonegatiation on some devices.
      Increase this timer duration to maximum supported 16ms.
      Signed-off-by: NMax Uvarov <muvarov@gmail.com>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      [ adapted for kernels without phy_modify_mmd ]
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36bef080
    • M
      net: phy: dp83867: fix speed 10 in sgmii mode · 87997a78
      Max Uvarov 提交于
      commit 333061b924539c0de081339643f45514f5f1c1e6 upstream.
      
      For supporting 10Mps speed in SGMII mode DP83867_10M_SGMII_RATE_ADAPT bit
      of DP83867_10M_SGMII_CFG register has to be cleared by software.
      That does not affect speeds 100 and 1000 so can be done on init.
      Signed-off-by: NMax Uvarov <muvarov@gmail.com>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      [ adapted for kernels without phy_modify_mmd ]
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87997a78
    • D
      mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span() · 5779cbc9
      David Hildenbrand 提交于
      commit 7ce700bf11b5e2cb84e4352bbdf2123a7a239c84 upstream.
      
      Let's limit shrinking to !ZONE_DEVICE so we can fix the current code.
      We should never try to touch the memmap of offline sections where we
      could have uninitialized memmaps and could trigger BUGs when calling
      page_to_nid() on poisoned pages.
      
      There is no reliable way to distinguish an uninitialized memmap from an
      initialized memmap that belongs to ZONE_DEVICE, as we don't have
      anything like SECTION_IS_ONLINE we can use similar to
      pfn_to_online_section() for !ZONE_DEVICE memory.
      
      E.g., set_zone_contiguous() similarly relies on pfn_to_online_section()
      and will therefore never set a ZONE_DEVICE zone consecutive.  Stopping
      to shrink the ZONE_DEVICE therefore results in no observable changes,
      besides /proc/zoneinfo indicating different boundaries - something we
      can totally live with.
      
      Before commit d0dc12e8 ("mm/memory_hotplug: optimize memory
      hotplug"), the memmap was initialized with 0 and the node with the right
      value.  So the zone might be wrong but not garbage.  After that commit,
      both the zone and the node will be garbage when touching uninitialized
      memmaps.
      
      Toshiki reported a BUG (race between delayed initialization of
      ZONE_DEVICE memmaps without holding the memory hotplug lock and
      concurrent zone shrinking).
      
        https://lkml.org/lkml/2019/11/14/1040
      
      "Iteration of create and destroy namespace causes the panic as below:
      
            kernel BUG at mm/page_alloc.c:535!
            CPU: 7 PID: 2766 Comm: ndctl Not tainted 5.4.0-rc4 #6
            Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014
            RIP: 0010:set_pfnblock_flags_mask+0x95/0xf0
            Call Trace:
             memmap_init_zone_device+0x165/0x17c
             memremap_pages+0x4c1/0x540
             devm_memremap_pages+0x1d/0x60
             pmem_attach_disk+0x16b/0x600 [nd_pmem]
             nvdimm_bus_probe+0x69/0x1c0
             really_probe+0x1c2/0x3e0
             driver_probe_device+0xb4/0x100
             device_driver_attach+0x4f/0x60
             bind_store+0xc9/0x110
             kernfs_fop_write+0x116/0x190
             vfs_write+0xa5/0x1a0
             ksys_write+0x59/0xd0
             do_syscall_64+0x5b/0x180
             entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
        While creating a namespace and initializing memmap, if you destroy the
        namespace and shrink the zone, it will initialize the memmap outside
        the zone and trigger VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page),
        pfn), page) in set_pfnblock_flags_mask()."
      
      This BUG is also mitigated by this commit, where we for now stop to
      shrink the ZONE_DEVICE zone until we can do it in a safe and clean way.
      
      Link: http://lkml.kernel.org/r/20191006085646.5768-5-david@redhat.com
      Fixes: f1dd2cd1 ("mm, memory_hotplug: do not associate hotadded memory to zones until online")	[visible after d0dc12e8]
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Reported-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Reported-by: NToshiki Fukasawa <t-fukasawa@vx.jp.nec.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Damian Tometzki <damian.tometzki@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Halil Pasic <pasic@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jun Yao <yaojun8558363@gmail.com>
      Cc: Logan Gunthorpe <logang@deltatee.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Pankaj Gupta <pagupta@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pavel Tatashin <pavel.tatashin@microsoft.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Steve Capper <steve.capper@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Wei Yang <richardw.yang@linux.intel.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Yu Zhao <yuzhao@google.com>
      Cc: <stable@vger.kernel.org>	[4.13+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5779cbc9
    • J
      md/raid10: prevent access of uninitialized resync_pages offset · a268d985
      John Pittman 提交于
      commit 45422b704db392a6d79d07ee3e3670b11048bd53 upstream.
      
      Due to unneeded multiplication in the out_free_pages portion of
      r10buf_pool_alloc(), when using a 3-copy raid10 layout, it is
      possible to access a resync_pages offset that has not been
      initialized.  This access translates into a crash of the system
      within resync_free_pages() while passing a bad pointer to
      put_page().  Remove the multiplication, preventing access to the
      uninitialized area.
      
      Fixes: f0250618 ("md: raid10: don't use bio's vec table to manage resync pages")
      Cc: stable@vger.kernel.org # 4.12+
      Signed-off-by: NJohn Pittman <jpittman@redhat.com>
      Suggested-by: NDavid Jeffery <djeffery@redhat.com>
      Reviewed-by: NLaurence Oberman <loberman@redhat.com>
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a268d985
    • D
      ath9k_hw: fix uninitialized variable data · f8dc0350
      Denis Efremov 提交于
      commit 80e84f36412e0c5172447b6947068dca0d04ee82 upstream.
      
      Currently, data variable in ar9003_hw_thermo_cal_apply() could be
      uninitialized if ar9300_otp_read_word() will fail to read the value.
      Initialize data variable with 0 to prevent an undefined behavior. This
      will be enough to handle error case when ar9300_otp_read_word() fails.
      
      Fixes: 80fe43f2 ("ath9k_hw: Read and configure thermocal for AR9462")
      Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
      Cc: John W. Linville <linville@tuxdriver.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDenis Efremov <efremov@linux.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8dc0350
    • H
      ath10k: Fix a NULL-ptr-deref bug in ath10k_usb_alloc_urb_from_pipe · f0cfe983
      Hui Peng 提交于
      commit bfd6e6e6c5d2ee43a3d9902b36e01fc7527ebb27 upstream.
      
      The `ar_usb` field of `ath10k_usb_pipe_usb_pipe` objects
      are initialized to point to the containing `ath10k_usb` object
      according to endpoint descriptors read from the device side, as shown
      below in `ath10k_usb_setup_pipe_resources`:
      
      for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
              endpoint = &iface_desc->endpoint[i].desc;
      
              // get the address from endpoint descriptor
              pipe_num = ath10k_usb_get_logical_pipe_num(ar_usb,
                                                      endpoint->bEndpointAddress,
                                                      &urbcount);
              ......
              // select the pipe object
              pipe = &ar_usb->pipes[pipe_num];
      
              // initialize the ar_usb field
              pipe->ar_usb = ar_usb;
      }
      
      The driver assumes that the addresses reported in endpoint
      descriptors from device side  to be complete. If a device is
      malicious and does not report complete addresses, it may trigger
      NULL-ptr-deref `ath10k_usb_alloc_urb_from_pipe` and
      `ath10k_usb_free_urb_to_pipe`.
      
      This patch fixes the bug by preventing potential NULL-ptr-deref.
      Signed-off-by: NHui Peng <benquike@gmail.com>
      Reported-by: NHui Peng <benquike@gmail.com>
      Reported-by: NMathias Payer <mathias.payer@nebelwelt.net>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [groeck: Add driver tag to subject, fix build warning]
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f0cfe983
    • S
      KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved · 4ae7392a
      Sean Christopherson 提交于
      commit a78986aae9b2988f8493f9f65a587ee433e83bc3 upstream.
      
      Explicitly exempt ZONE_DEVICE pages from kvm_is_reserved_pfn() and
      instead manually handle ZONE_DEVICE on a case-by-case basis.  For things
      like page refcounts, KVM needs to treat ZONE_DEVICE pages like normal
      pages, e.g. put pages grabbed via gup().  But for flows such as setting
      A/D bits or shifting refcounts for transparent huge pages, KVM needs to
      to avoid processing ZONE_DEVICE pages as the flows in question lack the
      underlying machinery for proper handling of ZONE_DEVICE pages.
      
      This fixes a hang reported by Adam Borowski[*] in dev_pagemap_cleanup()
      when running a KVM guest backed with /dev/dax memory, as KVM straight up
      doesn't put any references to ZONE_DEVICE pages acquired by gup().
      
      Note, Dan Williams proposed an alternative solution of doing put_page()
      on ZONE_DEVICE pages immediately after gup() in order to simplify the
      auditing needed to ensure is_zone_device_page() is called if and only if
      the backing device is pinned (via gup()).  But that approach would break
      kvm_vcpu_{un}map() as KVM requires the page to be pinned from map() 'til
      unmap() when accessing guest memory, unlike KVM's secondary MMU, which
      coordinates with mmu_notifier invalidations to avoid creating stale
      page references, i.e. doesn't rely on pages being pinned.
      
      [*] http://lkml.kernel.org/r/20190919115547.GA17963@angband.plReported-by: NAdam Borowski <kilobyte@angband.pl>
      Analyzed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NDan Williams <dan.j.williams@intel.com>
      Cc: stable@vger.kernel.org
      Fixes: 3565fce3 ("mm, x86: get_user_pages() for dax mappings")
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      [sean: backport to 4.x; resolve conflict in mmu.c]
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ae7392a
    • T
      Bluetooth: Fix invalid-free in bcsp_close() · 03bf4876
      Tomas Bortoli 提交于
      commit cf94da6f502d8caecabd56b194541c873c8a7a3c upstream.
      
      Syzbot reported an invalid-free that I introduced fixing a memleak.
      
      bcsp_recv() also frees bcsp->rx_skb but never nullifies its value.
      Nullify bcsp->rx_skb every time it is freed.
      Signed-off-by: NTomas Bortoli <tomasbortoli@gmail.com>
      Reported-by: syzbot+a0d209a4676664613e76@syzkaller.appspotmail.com
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Cc: Alexander Potapenko <glider@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03bf4876
    • V
      mm/page_io.c: do not free shared swap slots · 006360ec
      Vinayak Menon 提交于
      [ Upstream commit 5df373e95689b9519b8557da7c5bd0db0856d776 ]
      
      The following race is observed due to which a processes faulting on a
      swap entry, finds the page neither in swapcache nor swap.  This causes
      zram to give a zero filled page that gets mapped to the process,
      resulting in a user space crash later.
      
      Consider parent and child processes Pa and Pb sharing the same swap slot
      with swap_count 2.  Swap is on zram with SWP_SYNCHRONOUS_IO set.
      Virtual address 'VA' of Pa and Pb points to the shared swap entry.
      
      Pa                                       Pb
      
      fault on VA                              fault on VA
      do_swap_page                             do_swap_page
      lookup_swap_cache fails                  lookup_swap_cache fails
                                               Pb scheduled out
      swapin_readahead (deletes zram entry)
      swap_free (makes swap_count 1)
                                               Pb scheduled in
                                               swap_readpage (swap_count == 1)
                                               Takes SWP_SYNCHRONOUS_IO path
                                               zram enrty absent
                                               zram gives a zero filled page
      
      Fix this by making sure that swap slot is freed only when swap count
      drops down to one.
      
      Link: http://lkml.kernel.org/r/1571743294-14285-1-git-send-email-vinmenon@codeaurora.org
      Fixes: aa8d22a1 ("mm: swap: SWP_SYNCHRONOUS_IO: skip swapcache only if swapped page has no other reference")
      Signed-off-by: NVinayak Menon <vinmenon@codeaurora.org>
      Suggested-by: NMinchan Kim <minchan@google.com>
      Acked-by: NMinchan Kim <minchan@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      006360ec
    • J
      cfg80211: call disconnect_wk when AP stops · 16a300fb
      Johannes Berg 提交于
      [ Upstream commit e005bd7ddea06784c1eb91ac5bb6b171a94f3b05 ]
      
      Since we now prevent regulatory restore during STA disconnect
      if concurrent AP interfaces are active, we need to reschedule
      this check when the AP state changes. This fixes never doing
      a restore when an AP is the last interface to stop. Or to put
      it another way: we need to re-check after anything we check
      here changes.
      
      Cc: stable@vger.kernel.org
      Fixes: 113f3aaa81bd ("cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces")
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      16a300fb
    • D
      ipv6: Fix handling of LLA with VRF and sockets bound to VRF · 2b3541ff
      David Ahern 提交于
      [ Upstream commit c2027d1e17582903e368abf5d4838b22a98f2b7b ]
      
      A recent commit allows sockets bound to a VRF to receive ipv6 link local
      packets. However, it only works for UDP and worse TCP connection attempts
      to the LLA with the only listener bound to the VRF just hang where as
      before the client gets a reset and connection refused. Fix by adjusting
      ir_iif for LL addresses and packets received through a device enslaved
      to a VRF.
      
      Fixes: 6f12fa775530 ("vrf: mark skb for multicast or link-local as enslaved to VRF")
      Reported-by: NDonald Sharp <sharpd@cumulusnetworks.com>
      Cc: Mike Manning <mmanning@vyatta.att-mail.com>
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2b3541ff
    • Z
      mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock · 091ed093
      zhong jiang 提交于
      [ Upstream commit d2ab99403ee00d8014e651728a4702ea1ae5e52c ]
      
      When adding the memory by probing memory block in sysfs interface, there is an
      obvious issue that we will unlock the device_hotplug_lock when fails to takes it.
      
      That issue was introduced in Commit 8df1d0e4a265
      ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock")
      
      We should drop out in time when fails to take the device_hotplug_lock.
      
      Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock")
      Reported-by: NYang yingliang <yangyingliang@huawei.com>
      Signed-off-by: Nzhong jiang <zhongjiang@huawei.com>
      Reviewed-by: NOscar Salvador <osalvador@suse.de>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      091ed093
    • M
      i2c: uniphier-f: fix timeout error after reading 8 bytes · 896f7398
      Masahiro Yamada 提交于
      [ Upstream commit c2a653deaa81f5a750c0dfcbaf9f8e5195cbe4a5 ]
      
      I was totally screwed up in commit eaba68785c2d ("i2c: uniphier-f:
      fix race condition when IRQ is cleared"). Since that commit, if the
      number of read bytes is multiple of the FIFO size (8, 16, 24... bytes),
      the STOP condition could be issued twice, depending on the timing.
      If this happens, the controller will go wrong, resulting in the timeout
      error.
      
      It was more than 3 years ago when I wrote this driver, so my memory
      about this hardware was vague. Please let me correct the description
      in the commit log of eaba68785c2d.
      
      Clearing the IRQ status on exiting the IRQ handler is absolutely
      fine. This controller makes a pause while any IRQ status is asserted.
      If the IRQ status is cleared first, the hardware may start the next
      transaction before the IRQ handler finishes what it supposed to do.
      
      This partially reverts the bad commit with clear comments so that I
      will never repeat this mistake.
      
      I also investigated what is happening at the last moment of the read
      mode. The UNIPHIER_FI2C_INT_RF interrupt is asserted a bit earlier
      (by half a period of the clock cycle) than UNIPHIER_FI2C_INT_RB.
      
      I consulted a hardware engineer, and I got the following information:
      
      UNIPHIER_FI2C_INT_RF
          asserted at the falling edge of SCL at the 8th bit.
      
      UNIPHIER_FI2C_INT_RB
          asserted at the rising edge of SCL at the 9th (ACK) bit.
      
      In order to avoid calling uniphier_fi2c_stop() twice, check the latter
      interrupt. I also commented this because it is obscure hardware internal.
      
      Fixes: eaba68785c2d ("i2c: uniphier-f: fix race condition when IRQ is cleared")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      896f7398
    • V
      spi: omap2-mcspi: Fix DMA and FIFO event trigger size mismatch · 1efa17ab
      Vignesh R 提交于
      [ Upstream commit baf8b9f8d260c55a86405f70a384c29cda888476 ]
      
      Commit b682cffa3ac6 ("spi: omap2-mcspi: Set FIFO DMA trigger level to word length")
      broke SPI transfers where bits_per_word != 8. This is because of
      mimsatch between McSPI FIFO level event trigger size (SPI word length) and
      DMA request size(word length * maxburst). This leads to data
      corruption, lockup and errors like:
      
      	spi1.0: EOW timed out
      
      Fix this by setting DMA maxburst size to 1 so that
      McSPI FIFO level event trigger size matches DMA request size.
      
      Fixes: b682cffa3ac6 ("spi: omap2-mcspi: Set FIFO DMA trigger level to word length")
      Cc: stable@vger.kernel.org
      Reported-by: NDavid Lechner <david@lechnology.com>
      Tested-by: NDavid Lechner <david@lechnology.com>
      Signed-off-by: NVignesh R <vigneshr@ti.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1efa17ab
    • I
      nvme-pci: fix surprise removal · 1b0f1b2d
      Igor Konopko 提交于
      [ Upstream commit 751a0cc0cd3a0d51e6aaf6fd3b8bd31f4ecfaf3e ]
      
      When a PCIe NVMe device is not present, nvme_dev_remove_admin() calls
      blk_cleanup_queue() on the admin queue, which frees the hctx for that
      queue.  Moments later, on the same path nvme_kill_queues() calls
      blk_mq_unquiesce_queue() on admin queue and tries to access hctx of it,
      which leads to following OOPS:
      
      Oops: 0000 [#1] SMP PTI
      RIP: 0010:sbitmap_any_bit_set+0xb/0x40
      Call Trace:
       blk_mq_run_hw_queue+0xd5/0x150
       blk_mq_run_hw_queues+0x3a/0x50
       nvme_kill_queues+0x26/0x50
       nvme_remove_namespaces+0xb2/0xc0
       nvme_remove+0x60/0x140
       pci_device_remove+0x3b/0xb0
      
      Fixes: cb4bfda62afa2 ("nvme-pci: fix hot removal during error handling")
      Signed-off-by: NIgor Konopko <igor.j.konopko@intel.com>
      Reviewed-by: NKeith Busch <keith.busch@intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1b0f1b2d
    • K
      PCI: keystone: Use quirk to limit MRRS for K2G · 597a37d0
      Kishon Vijay Abraham I 提交于
      [ Upstream commit 148e340c0696369fadbbddc8f4bef801ed247d71 ]
      
      PCI controller in K2G also has a limitation that memory read request
      size (MRRS) must not exceed 256 bytes. Use the quirk to limit MRRS
      (added for K2HK, K2L and K2E) for K2G as well.
      Signed-off-by: NKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      597a37d0
    • N
      pinctrl: zynq: Use define directive for PIN_CONFIG_IO_STANDARD · c0418c4a
      Nathan Chancellor 提交于
      [ Upstream commit cd8a145a066a1a3beb0ae615c7cb2ee4217418d7 ]
      
      Clang warns when one enumerated type is implicitly converted to another:
      
      drivers/pinctrl/pinctrl-zynq.c:985:18: warning: implicit conversion from
      enumeration type 'enum zynq_pin_config_param' to different enumeration
      type 'enum pin_config_param' [-Wenum-conversion]
              {"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18},
              ~               ^~~~~~~~~~~~~~~~~~~~~
      drivers/pinctrl/pinctrl-zynq.c:990:16: warning: implicit conversion from
      enumeration type 'enum zynq_pin_config_param' to different enumeration
      type 'enum pin_config_param' [-Wenum-conversion]
              = { PCONFDUMP(PIN_CONFIG_IOSTANDARD, "IO-standard", NULL, true),
                  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/pinctrl/pinconf-generic.h:163:11: note: expanded from
      macro 'PCONFDUMP'
              .param = a, .display = b, .format = c, .has_arg = d     \
                       ^
      2 warnings generated.
      
      It is expected that pinctrl drivers can extend pin_config_param because
      of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion
      isn't an issue. Most drivers that take advantage of this define the
      PIN_CONFIG variables as constants, rather than enumerated values. Do the
      same thing here so that Clang no longer warns.
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Acked-by: NMichal Simek <michal.simek@xilinx.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c0418c4a
    • N
      pinctrl: lpc18xx: Use define directive for PIN_CONFIG_GPIO_PIN_INT · 0858006c
      Nathan Chancellor 提交于
      [ Upstream commit f24bfb39975c241374cadebbd037c17960cf1412 ]
      
      Clang warns when one enumerated type is implicitly converted to another:
      
      drivers/pinctrl/pinctrl-lpc18xx.c:643:29: warning: implicit conversion
      from enumeration type 'enum lpc18xx_pin_config_param' to different
      enumeration type 'enum pin_config_param' [-Wenum-conversion]
              {"nxp,gpio-pin-interrupt", PIN_CONFIG_GPIO_PIN_INT, 0},
              ~                          ^~~~~~~~~~~~~~~~~~~~~~~
      drivers/pinctrl/pinctrl-lpc18xx.c:648:12: warning: implicit conversion
      from enumeration type 'enum lpc18xx_pin_config_param' to different
      enumeration type 'enum pin_config_param' [-Wenum-conversion]
              PCONFDUMP(PIN_CONFIG_GPIO_PIN_INT, "gpio pin int", NULL, true),
              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/pinctrl/pinconf-generic.h:163:11: note: expanded from
      macro 'PCONFDUMP'
              .param = a, .display = b, .format = c, .has_arg = d     \
                       ^
      2 warnings generated.
      
      It is expected that pinctrl drivers can extend pin_config_param because
      of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion
      isn't an issue. Most drivers that take advantage of this define the
      PIN_CONFIG variables as constants, rather than enumerated values. Do the
      same thing here so that Clang no longer warns.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/140Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0858006c
    • N
      pinctrl: bcm2835: Use define directive for BCM2835_PINCONF_PARAM_PULL · 5efa36e7
      Nathan Chancellor 提交于
      [ Upstream commit b40ac08ff886302a6aa457fd72e94a969f50e245 ]
      
      Clang warns when one enumerated type is implicitly converted to another:
      
      drivers/pinctrl/bcm/pinctrl-bcm2835.c:707:40: warning: implicit
      conversion from enumeration type 'enum bcm2835_pinconf_param' to
      different enumeration type 'enum pin_config_param' [-Wenum-conversion]
              configs[0] = pinconf_to_config_packed(BCM2835_PINCONF_PARAM_PULL, pull);
                           ~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      
      It is expected that pinctrl drivers can extend pin_config_param because
      of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion
      isn't an issue. Most drivers that take advantage of this define the
      PIN_CONFIG variables as constants, rather than enumerated values. Do the
      same thing here so that Clang no longer warns.
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Acked-by: NStefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      5efa36e7
    • B
      pinctrl: qcom: spmi-gpio: fix gpio-hog related boot issues · bad4da12
      Brian Masney 提交于
      [ Upstream commit 149a96047237574b756d872007c006acd0cc6687 ]
      
      When attempting to setup up a gpio hog, device probing would repeatedly
      fail with -EPROBE_DEFERED errors. It was caused by a circular dependency
      between the gpio and pinctrl frameworks. If the gpio-ranges property is
      present in device tree, then the gpio framework will handle the gpio pin
      registration and eliminate the circular dependency.
      
      See Christian Lamparter's commit a86caa9b ("pinctrl: msm: fix
      gpio-hog related boot issues") for a detailed commit message that
      explains the issue in much more detail. The code comment in this commit
      came from Christian's commit.
      Signed-off-by: NBrian Masney <masneyb@onstation.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      bad4da12
    • S
      cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces · c24fe780
      Sriram R 提交于
      [ Upstream commit 113f3aaa81bd56aba02659786ed65cbd9cb9a6fc ]
      
      Currently when an AP and STA interfaces are active in the same or different
      radios, regulatory settings are restored whenever the STA disconnects. This
      restores all channel information including dfs states in all radios.
      For example, if an AP interface is active in one radio and STA in another,
      when radar is detected on the AP interface, the dfs state of the channel
      will be changed to UNAVAILABLE. But when the STA interface disconnects,
      this issues a regulatory disconnect hint which restores all regulatory
      settings in all the radios attached and thereby losing the stored dfs
      state on the other radio where the channel was marked as unavailable
      earlier. Hence prevent such regulatory restore whenever another active
      beaconing interface is present in the same or other radios.
      Signed-off-by: NSriram R <srirrama@codeaurora.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c24fe780
    • Q
      tools: bpftool: pass an argument to silence open_obj_pinned() · ee7d2473
      Quentin Monnet 提交于
      [ Upstream commit f120919f9905a2cad9dea792a28a11fb623f72c1 ]
      
      Function open_obj_pinned() prints error messages when it fails to open a
      link in the BPF virtual file system. However, in some occasions it is
      not desirable to print an error, for example when we parse all links
      under the bpffs root, and the error is due to some paths actually being
      symbolic links.
      
      Example output:
      
          # ls -l /sys/fs/bpf/
          lrwxrwxrwx 1 root root 0 Oct 18 19:00 ip -> /sys/fs/bpf/tc/
          drwx------ 3 root root 0 Oct 18 19:00 tc
          lrwxrwxrwx 1 root root 0 Oct 18 19:00 xdp -> /sys/fs/bpf/tc/
      
          # bpftool --bpffs prog show
          Error: bpf obj get (/sys/fs/bpf): Permission denied
          Error: bpf obj get (/sys/fs/bpf): Permission denied
      
          # strace -e bpf bpftool --bpffs prog show
          bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/ip", bpf_fd=0}, 72) = -1 EACCES (Permission denied)
          Error: bpf obj get (/sys/fs/bpf): Permission denied
          bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/xdp", bpf_fd=0}, 72) = -1 EACCES (Permission denied)
          Error: bpf obj get (/sys/fs/bpf): Permission denied
          ...
      
      To fix it, pass a bool as a second argument to the function, and prevent
      it from printing an error when the argument is set to true.
      Signed-off-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ee7d2473
    • F
      of: unittest: initialize args before calling of_*parse_*() · 367e64ce
      Frank Rowand 提交于
      [ Upstream commit eeb07c573ec307c53fe2f6ac6d8d11c261f64006 ]
      
      Callers of of_irq_parse_one() blindly use the pointer args.np
      without checking whether of_irq_parse_one() had an error and
      thus did not set the value of args.np.  Initialize args to
      zero so that using the format "%pOF" to show the value of
      args.np will show "(null)" when of_irq_parse_one() has an
      error.  This prevents the dereference of a random value.
      
      Make the same fix for callers of of_parse_phandle_with_args()
      and of_parse_phandle_with_args_map().
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Tested-by: NAlan Tull <atull@kernel.org>
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      367e64ce
    • F
      of: unittest: allow base devicetree to have symbol metadata · e4547e02
      Frank Rowand 提交于
      [ Upstream commit 5babefb7f7ab1f23861336d511cc666fa45ede82 ]
      
      The overlay metadata nodes in the FDT created from testcases.dts
      are not handled properly.
      
      The __fixups__ and __local_fixups__ node were added to the live
      devicetree, but should not be.
      
      Only the first property in the /__symbols__ node was added to the
      live devicetree if the live devicetree already contained a
      /__symbols node.  All of the node's properties must be added.
      Tested-by: NAlan Tull <atull@kernel.org>
      Signed-off-by: NFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e4547e02
    • Y
      net: bcmgenet: return correct value 'ret' from bcmgenet_power_down · 1303c938
      YueHaibing 提交于
      [ Upstream commit 0db55093b56618088b9a1d445eb6e43b311bea33 ]
      
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/net/ethernet/broadcom/genet/bcmgenet.c: In function 'bcmgenet_power_down':
      drivers/net/ethernet/broadcom/genet/bcmgenet.c:1136:6: warning:
       variable 'ret' set but not used [-Wunused-but-set-variable]
      
      bcmgenet_power_down should return 'ret' instead of 0.
      
      Fixes: ca8cf341 ("net: bcmgenet: propagate errors from bcmgenet_power_down")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1303c938
    • C
      ACPICA: Use %d for signed int print formatting instead of %u · 1d6a0dd6
      Colin Ian King 提交于
      [ Upstream commit f8ddf49b420112e28bdd23d7ad52d7991a0ccbe3 ]
      
      Fix warnings found using static analysis with cppcheck, use %d printf
      format specifier for signed ints rather than %u
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NErik Schmauss <erik.schmauss@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1d6a0dd6
    • D
      clk: tegra20: Turn EMC clock gate into divider · d15b8b69
      Dmitry Osipenko 提交于
      [ Upstream commit 514fddba845ed3a1b17e01e99cb3a2a52256a88a ]
      
      Kernel should never gate the EMC clock as it causes immediate lockup, so
      removing clk-gate functionality doesn't affect anything. Turning EMC clk
      gate into divider allows to implement glitch-less EMC scaling, avoiding
      reparenting to a backup clock.
      Signed-off-by: NDmitry Osipenko <digetx@gmail.com>
      Acked-by: NPeter De Schrijver <pdeschrijver@nvidia.com>
      Acked-by: NStephen Boyd <sboyd@kernel.org>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d15b8b69
    • M
      vrf: mark skb for multicast or link-local as enslaved to VRF · 91c5f99d
      Mike Manning 提交于
      [ Upstream commit 6f12fa775530195a501fb090d092c637f32d0cc5 ]
      
      The skb for packets that are multicast or to a link-local address are
      not marked as being enslaved to a VRF, if they are received on a socket
      bound to the VRF. This is needed for ND and it is preferable for the
      kernel not to have to deal with the additional use-cases if ll or mcast
      packets are handled as enslaved. However, this does not allow service
      instances listening on unbound and bound to VRF sockets to distinguish
      the VRF used, if packets are sent as multicast or to a link-local
      address. The fix is for the VRF driver to also mark these skb as being
      enslaved to the VRF.
      Signed-off-by: NMike Manning <mmanning@vyatta.att-mail.com>
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      91c5f99d
    • T
      dlm: don't leak kernel pointer to userspace · 5c2a3997
      Tycho Andersen 提交于
      [ Upstream commit 9de30f3f7f4d31037cfbb7c787e1089c1944b3a7 ]
      
      In copy_result_to_user(), we first create a struct dlm_lock_result, which
      contains a struct dlm_lksb, the last member of which is a pointer to the
      lvb. Unfortunately, we copy the entire struct dlm_lksb to the result
      struct, which is then copied to userspace at the end of the function,
      leaking the contents of sb_lvbptr, which is a valid kernel pointer in some
      cases (indeed, later in the same function the data it points to is copied
      to userspace).
      
      It is an error to leak kernel pointers to userspace, as it undermines KASLR
      protections (see e.g. 65eea8ed ("floppy: Do not copy a kernel pointer to
      user memory in FDGETPRM ioctl") for another example of this).
      Signed-off-by: NTycho Andersen <tycho@tycho.ws>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      5c2a3997
    • T
      dlm: fix invalid free · afb4717a
      Tycho Andersen 提交于
      [ Upstream commit d968b4e240cfe39d39d80483bac8bca8716fd93c ]
      
      dlm_config_nodes() does not allocate nodes on failure, so we should not
      free() nodes when it fails.
      Signed-off-by: NTycho Andersen <tycho@tycho.ws>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      afb4717a
    • B
      usb: typec: tcpm: charge current handling for sink during hard reset · 30fc13ae
      Badhri Jagan Sridharan 提交于
      [ Upstream commit 157c0f2f641a9938382b092c64548ebdabfe25e0 ]
      
      During the initial connect to a non-pd port, sink would hard reset
      twice before deeming that the port partner is non-pd. TCPM sets the
      the charge path to false during the hard reset. This causes unnecessary
      connects/disconnects of charge path and makes port take longer to
      charge from the non-pd ports. Avoid this by not setting the charge path
      to false unless the partner has already identified to be pd capable.
      
      When partner is a pd port, set the charge path to false in
      SNK_HARD_RESET_SINK_OFF. Set the current limits to default value based
      of CC pull up and resume the charge path when port enters
      SNK_HARD_RESET_SINK_ON.
      Signed-off-by: NBadhri Jagan Sridharan <badhri@google.com>
      Reviewed-by: NRob Herring <robh@kernel.org>
      Reviewed-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
      
      --------
      Changes in V3:
      Rebase on top of usb-next
      
      Changes in V2:
      Based on feedback of jackp@codeaurora.org
      - vsafe_5v_hard_reset flag from tcpc_config is removed
      - Patch only differentiates between pd port partner and non-pd port
      partner
      
      V1 version of the patch is here:
      https://lkml.org/lkml/2018/9/14/11Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      30fc13ae
    • J
      scsi: lpfc: Correct loss of fc4 type on remote port address change · 5e989b6c
      James Smart 提交于
      [ Upstream commit d83ca3ea833d7a66d49225e4191c4e37cab8f079 ]
      
      An address change for a remote port cause PRLI for the wrong protocol
      to be sent.  The node copy done in the discovery code skipped copying
      the fc4 protocols supported as well.
      
      Fix the copy logic for the address change.  Beefed up log messages in
      this area as well.
      Signed-off-by: NDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: NJames Smart <jsmart2021@gmail.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      5e989b6c
    • J
      scsi: lpfc: Fix odd recovery in duplicate FLOGIs in point-to-point · a391709b
      James Smart 提交于
      [ Upstream commit d496b9a7246cb9813da1fe49e14edbbbf8e232d5 ]
      
      Testing a point-to-point topology and a case of re-FLOGI without
      intervening link bouncing, showed an odd interaction with firmware and
      a resulting scenario where the driver no longer probed after accepting
      the new FLOGI.
      
      Work around the firmware issue by issuing a link bounce if a FLOGI is
      received after the link is already up and FLOGI's accepted.
      
      While debugging the issue, realized that some debug traces should be
      clarified to help in the future.
      Signed-off-by: NDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: NJames Smart <jsmart2021@gmail.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a391709b
    • J
      scsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces · 05678af0
      James Smart 提交于
      [ Upstream commit 036cad1f1ac9ce03e2db94b8460f98eaf1e1ee4c ]
      
      On FCoE adapters, when running link bounce test in a loop, initiator
      failed to login with switch switch and required driver reload to
      recover. Switch reached a point where all subsequent FLOGIs would be
      LS_RJT'd. Further testing showed the condition to be related to not
      performing FCF discovery between FLOGI's.
      
      Fix by monitoring FLOGI failures and once a repeated error is seen
      repeat FCF discovery.
      Signed-off-by: NDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: NJames Smart <jsmart2021@gmail.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      05678af0