1. 27 11月, 2018 40 次提交
    • M
      s390/mm: fix mis-accounting of pgtable_bytes · 4136161d
      Martin Schwidefsky 提交于
      [ Upstream commit e12e4044aede97974f2222eb7f0ed726a5179a32 ]
      
      In case a fork or a clone system fails in copy_process and the error
      handling does the mmput() at the bad_fork_cleanup_mm label, the
      following warning messages will appear on the console:
      
        BUG: non-zero pgtables_bytes on freeing mm: 16384
      
      The reason for that is the tricks we play with mm_inc_nr_puds() and
      mm_inc_nr_pmds() in init_new_context().
      
      A normal 64-bit process has 3 levels of page table, the p4d level and
      the pud level are folded. On process termination the free_pud_range()
      function in mm/memory.c will subtract 16KB from pgtable_bytes with a
      mm_dec_nr_puds() call, but there actually is not really a pud table.
      
      One issue with this is the fact that pgtable_bytes is usually off
      by a few kilobytes, but the more severe problem is that for a failed
      fork or clone the free_pgtables() function is not called. In this case
      there is no mm_dec_nr_puds() or mm_dec_nr_pmds() that go together with
      the mm_inc_nr_puds() and mm_inc_nr_pmds in init_new_context().
      The pgtable_bytes will be off by 16384 or 32768 bytes and we get the
      BUG message. The message itself is purely cosmetic, but annoying.
      
      To fix this override the mm_pmd_folded, mm_pud_folded and mm_p4d_folded
      function to check for the true size of the address space.
      Reported-by: NLi Wang <liwang@redhat.com>
      Tested-by: NLi Wang <liwang@redhat.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      4136161d
    • A
      netfilter: ipset: fix ip_set_list allocation failure · 97fdf29f
      Andrey Ryabinin 提交于
      [ Upstream commit ed956f3947a01ff9875cd908d7c1ef1fe7f47bf0 ]
      
      ip_set_create() and ip_set_net_init() attempt to allocate physically
      contiguous memory for ip_set_list. If memory is fragmented, the
      allocations could easily fail:
      
              vzctl: page allocation failure: order:7, mode:0xc0d0
      
              Call Trace:
               dump_stack+0x19/0x1b
               warn_alloc_failed+0x110/0x180
               __alloc_pages_nodemask+0x7bf/0xc60
               alloc_pages_current+0x98/0x110
               kmalloc_order+0x18/0x40
               kmalloc_order_trace+0x26/0xa0
               __kmalloc+0x279/0x290
               ip_set_net_init+0x4b/0x90 [ip_set]
               ops_init+0x3b/0xb0
               setup_net+0xbb/0x170
               copy_net_ns+0xf1/0x1c0
               create_new_namespaces+0xf9/0x180
               copy_namespaces+0x8e/0xd0
               copy_process+0xb61/0x1a00
               do_fork+0x91/0x320
      
      Use kvcalloc() to fallback to 0-order allocations if high order
      page isn't available.
      Signed-off-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      97fdf29f
    • E
      netfilter: ipset: actually allow allowable CIDR 0 in hash:net,port,net · cb3e590d
      Eric Westbrook 提交于
      [ Upstream commit 886503f34d63e681662057448819edb5b1057a97 ]
      
      Allow /0 as advertised for hash:net,port,net sets.
      
      For "hash:net,port,net", ipset(8) says that "either subnet
      is permitted to be a /0 should you wish to match port
      between all destinations."
      
      Make that statement true.
      
      Before:
      
          # ipset create cidrzero hash:net,port,net
          # ipset add cidrzero 0.0.0.0/0,12345,0.0.0.0/0
          ipset v6.34: The value of the CIDR parameter of the IP address is invalid
      
          # ipset create cidrzero6 hash:net,port,net family inet6
          # ipset add cidrzero6 ::/0,12345,::/0
          ipset v6.34: The value of the CIDR parameter of the IP address is invalid
      
      After:
      
          # ipset create cidrzero hash:net,port,net
          # ipset add cidrzero 0.0.0.0/0,12345,0.0.0.0/0
          # ipset test cidrzero 192.168.205.129,12345,172.16.205.129
          192.168.205.129,tcp:12345,172.16.205.129 is in set cidrzero.
      
          # ipset create cidrzero6 hash:net,port,net family inet6
          # ipset add cidrzero6 ::/0,12345,::/0
          # ipset test cidrzero6 fe80::1,12345,ff00::1
          fe80::1,tcp:12345,ff00::1 is in set cidrzero6.
      
      See also:
      
        https://bugzilla.kernel.org/show_bug.cgi?id=200897
        https://github.com/ewestbrook/linux/commit/df7ff6efb0934ab6acc11f003ff1a7580d6c1d9cSigned-off-by: NEric Westbrook <linux@westbrook.io>
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      cb3e590d
    • S
      netfilter: ipset: list:set: Decrease refcount synchronously on deletion and replace · c75116e6
      Stefano Brivio 提交于
      [ Upstream commit 439cd39ea136d2c026805264d58a91f36b6b64ca ]
      
      Commit 45040978 ("netfilter: ipset: Fix set:list type crash
      when flush/dump set in parallel") postponed decreasing set
      reference counters to the RCU callback.
      
      An 'ipset del' command can terminate before the RCU grace period
      is elapsed, and if sets are listed before then, the reference
      counter shown in userspace will be wrong:
      
       # ipset create h hash:ip; ipset create l list:set; ipset add l
       # ipset del l h; ipset list h
       Name: h
       Type: hash:ip
       Revision: 4
       Header: family inet hashsize 1024 maxelem 65536
       Size in memory: 88
       References: 1
       Number of entries: 0
       Members:
       # sleep 1; ipset list h
       Name: h
       Type: hash:ip
       Revision: 4
       Header: family inet hashsize 1024 maxelem 65536
       Size in memory: 88
       References: 0
       Number of entries: 0
       Members:
      
      Fix this by making the reference count update synchronous again.
      
      As a result, when sets are listed, ip_set_name_byindex() might
      now fetch a set whose reference count is already zero. Instead
      of relying on the reference count to protect against concurrent
      set renaming, grab ip_set_ref_lock as reader and copy the name,
      while holding the same lock in ip_set_rename() as writer
      instead.
      Reported-by: NLi Shuang <shuali@redhat.com>
      Fixes: 45040978 ("netfilter: ipset: Fix set:list type crash when flush/dump set in parallel")
      Signed-off-by: NStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: NJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c75116e6
    • P
      Revert "netfilter: nft_numgen: add map lookups for numgen random operations" · fecf70b1
      Pablo Neira Ayuso 提交于
      [ Upstream commit 4269fea768a11a447d8de620ce420f2214d4685c ]
      
      Laura found a better way to do this from userspace without requiring
      kernel infrastructure, revert this.
      
      Fixes: 978d8f90 ("netfilter: nft_numgen: add map lookups for numgen random operations")
      Signed-off-by: NLaura Garcia Liebana <nevola@gmail.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      fecf70b1
    • B
      HID: alps: allow incoming reports when only the trackstick is opened · 67b261d7
      Benjamin Tissoires 提交于
      [ Upstream commit 7dd8db68949a7acc5bd528ee0ecb8f8720f49921 ]
      
      If userspace only reads the trackstick node, and no one is listening to
      the touchpad nor the hidraw node then, the device is not powered on.
      
      Add open/close callbacks to allow users to disable the touchpad in Gnome
      while keeping the trackstick active.
      
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1559632
      Link: https://gitlab.gnome.org/GNOME/mutter/issues/128Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      67b261d7
    • B
      Revert "HID: add NOGET quirk for Eaton Ellipse MAX UPS" · 3b7b2382
      Benjamin Tissoires 提交于
      [ Upstream commit 6298944d8f57f40ee2a3e6dcea1253e78d7a9969 ]
      
      This reverts commit 67ddbb3e.
      
      67ddbb3e ("HID: add NOGET quirk for Eaton Ellipse MAX UPS") was reported
      by Laurent Bigonville. It turns out that a later model Laurent got
      doesn't need the quirk after all.
      
      My take is that Eaton upgraded their firmwares, so we don't need it
      anymore.
      
      The old model was from 2012, so better make sure the new line works
      properly by removing the quirk. This allows upower to actually fetch
      the current data.
      Reported-by: NLaurent Bigonville <bigon@bigon.be>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      3b7b2382
    • K
      HID: i2c-hid: Add a small delay after sleep command for Raydium touchpanel · 48d49b63
      Kai-Heng Feng 提交于
      [ Upstream commit 00b790ea545b6ef30221adef6e9c3707e03b82b5 ]
      
      Raydium touchpanel (2386:4B33) sometimes does not work in desktop session
      although it works in display manager.
      
      During user logging, the display manager exits, close the HID device,
      then the device gets runtime suspended and powered off. The desktop
      session begins shortly after, opens the HID device, then the device gets
      runtime resumed and powered on.
      
      If the trasition from display manager to desktop sesesion is fast, the
      touchpanel cannot switch from powered off to powered on in short
      timeframe. So add a small delay to workaround the issue.
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      48d49b63
    • V
      s390/vdso: add missing FORCE to build targets · 1d5dfce7
      Vasily Gorbik 提交于
      [ Upstream commit b44b136a3773d8a9c7853f8df716bd1483613cbb ]
      
      According to Documentation/kbuild/makefiles.txt all build targets using
      if_changed should use FORCE as well. Add missing FORCE to make sure
      vdso targets are rebuild properly when not just immediate prerequisites
      have changed but also when build command differs.
      Reviewed-by: NPhilipp Rudo <prudo@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1d5dfce7
    • V
      s390/decompressor: add missing FORCE to build targets · 9b2d5118
      Vasily Gorbik 提交于
      [ Upstream commit ef5febae1543f35a45f01614123e829d77326d0f ]
      
      According to Documentation/kbuild/makefiles.txt all build targets
      using if_changed should use FORCE as well. Add missing FORCE to make
      sure vmlinux decompressor targets are rebuild properly when not just
      immediate prerequisites have changed but also when build command differs.
      Reviewed-by: NPhilipp Rudo <prudo@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      9b2d5118
    • J
      netfilter: bridge: define INT_MIN & INT_MAX in userspace · a3123502
      Jiri Slaby 提交于
      [ Upstream commit 5a8de47b3c250521dd632cdedaac6db88367defa ]
      
      With 4.19, programs like ebtables fail to build when they include
      "linux/netfilter_bridge.h". It is caused by commit 94276fa8 which
      added a use of INT_MIN and INT_MAX to the header:
      : In file included from /usr/include/linux/netfilter_bridge/ebtables.h:18,
      :                  from include/ebtables_u.h:28,
      :                  from communication.c:23:
      : /usr/include/linux/netfilter_bridge.h:30:20: error: 'INT_MIN' undeclared here (not in a function)
      :   NF_BR_PRI_FIRST = INT_MIN,
      :                     ^~~~~~~
      
      Define these constants by including "limits.h" when !__KERNEL__ (the
      same way as for other netfilter_* headers).
      
      Fixes: 94276fa8 ("netfilter: bridge: Expose nf_tables bridge hook priorities through uapi")
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NMáté Eckl <ecklm94@gmail.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a3123502
    • F
      netfilter: ipv6: fix oops when defragmenting locally generated fragments · 84ed07d9
      Florian Westphal 提交于
      [ Upstream commit 61792b677415b77c8db04991c22966bb8de7603e ]
      
      Unlike ipv4 and normal ipv6 defrag, netfilter ipv6 defragmentation did
      not save/restore skb->dst.
      
      This causes oops when handling locally generated ipv6 fragments, as
      output path needs a valid dst.
      Reported-by: NMaciej Żenczykowski <zenczykowski@gmail.com>
      Fixes: 84379c9a ("netfilter: ipv6: nf_defrag: drop skb dst before queueing")
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      84ed07d9
    • G
      serial: sh-sci: Fix receive on SCIFA/SCIFB variants with DMA · c2c72619
      Geert Uytterhoeven 提交于
      [ Upstream commit 202dc3cc10b4d37e5251431acf8d5040a8876c7d ]
      
      On SCIFA and SCIFB serial ports with DMA support (i.e. some ports on
      R-Car Gen2 and RZ/G1 SoCs), receive DMA operations are submitted before
      the DMA channel pointer is initialized.  Hence this fails, and the
      driver tries to fall back to PIO.  However, at this early phase in the
      initialization sequence, fallback to PIO does not work, leading to a
      serial port that cannot receive any data.
      
      Fix this by calling sci_submit_rx() after initialization of the DMA
      channel pointer.
      Reported-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Fixes: 2c4ee235 ("serial: sh-sci: Postpone DMA release when falling back to PIO")
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Tested-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c2c72619
    • J
      clk: ti: fix OF child-node lookup · 459852bf
      Johan Hovold 提交于
      [ Upstream commit 00a461cc32ec27fa7bd9c874a7b36b0c6c542c12 ]
      
      Fix child-node lookup which by using the wrong OF helper was searching
      the whole tree depth-first, something which could end up matching an
      unrelated node.
      
      Also fix the related node-reference leaks.
      
      Fixes: 5b385a45 ("clk: ti: add support for clkctrl aliases")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NTero Kristo <t-kristo@ti.com>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      459852bf
    • P
      clk: renesas: r9a06g032: Fix UART34567 clock rate · 1e5ac602
      Phil Edworthy 提交于
      [ Upstream commit ee02950d53eee0d4c7f1c08a35272b77d24b9459 ]
      
      The clock for UARTs 0 through 2 is UART012, the clock for UARTs 3 through
      7 is UART34567.
      For UART012, we stop the clock driver from changing the clock rate. This
      is because the Synopsys UART driver simply sets the reference clock to 16x
      the baud rate, but doesn't check if the actual rate is within the required
      tolerance. The RZ/N1 clock divider can't provide this (we have to rely on
      the UART's internal divider to set the correct clock rate), so you end up
      with a clock rate that is way off what you wanted.
      
      In addition, since the clock is shared between multiple UARTs, you don't
      want the driver trying to change the clock rate as it may affect the other
      UARTs (which may not have been configured yet, so you don't know what baud
      rate they will use). Normally, the clock rate is set early on before Linux
      to some very high rate that supports all of the clock rates you want.
      
      This change stops the UART34567 clock rate from changing for the same
      reasons.
      Signed-off-by: NPhil Edworthy <phil.edworthy@renesas.com>
      Fixes: 4c3d8852 ("clk: renesas: Renesas R9A06G032 clock driver")
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1e5ac602
    • J
      clk: meson: clk-pll: drop CLK_GET_RATE_NOCACHE where unnecessary · a178c7ab
      Jerome Brunet 提交于
      [ Upstream commit 2303a9ca693e585a558497ad737728fec97e2b8a ]
      
      CLK_GET_RATE_NOCACHE should only be necessary when the registers
      controlling the rate of clock may change outside of CCF. On Amlogic,
      it should only be the case for the hdmi pll which is directly controlled
      by the display driver (WIP to fix this).
      
      The other plls should not require this flag.
      Reviewed-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Tested-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a178c7ab
    • N
      arm64: percpu: Initialize ret in the default case · ee9b3813
      Nathan Chancellor 提交于
      [ Upstream commit b5bb425871186303e6936fa2581521bdd1964a58 ]
      
      Clang warns that if the default case is taken, ret will be
      uninitialized.
      
      ./arch/arm64/include/asm/percpu.h:196:2: warning: variable 'ret' is used
      uninitialized whenever switch default is taken
      [-Wsometimes-uninitialized]
              default:
              ^~~~~~~
      ./arch/arm64/include/asm/percpu.h:200:9: note: uninitialized use occurs
      here
              return ret;
                     ^~~
      ./arch/arm64/include/asm/percpu.h:157:19: note: initialize the variable
      'ret' to silence this warning
              unsigned long ret, loop;
                               ^
                                = 0
      
      This warning appears several times while building the erofs filesystem.
      While it's not strictly wrong, the BUILD_BUG will prevent this from
      becoming a true problem. Initialize ret to 0 in the default case right
      before the BUILD_BUG to silence all of these warnings.
      Reported-by: NPrasad Sodagudi <psodagud@codeaurora.org>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NDennis Zhou <dennis@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ee9b3813
    • Y
      clk: meson-axg: pcie: drop the mpll3 clock parent · e252c95d
      Yixun Lan 提交于
      [ Upstream commit 69b93104c7ec5668019caf5d2dbfd0e182df06db ]
      
      We found the PCIe driver doesn't really work with
      the mpll3 clock which is actually reserved for debug,
      So drop it from the mux list.
      
      Fixes: 33b89db68236 ("clk: meson-axg: add clocks required by pcie driver")
      Tested-by: NJianxin Qin <jianxin.qin@amlogic.com>
      Signed-off-by: NYixun Lan <yixun.lan@amlogic.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e252c95d
    • P
      platform/x86: acerhdf: Add BIOS entry for Gateway LT31 v1.3307 · e28f4634
      Paul Gortmaker 提交于
      [ Upstream commit 684238d79ad85c5e19a71bb5818e77e329912fbc ]
      
      To fix:
      
        acerhdf: unknown (unsupported) BIOS version Gateway  /LT31   /v1.3307 , please report, aborting!
      
      As can be seen in the context, the BIOS registers haven't changed in
      the previous versions, so the assumption is they won't have changed
      in this last update for this somewhat older platform either.
      
      Cc: Peter Feuerer <peter@piie.net>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NPeter Feuerer <peter@piie.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e28f4634
    • F
      x86/earlyprintk: Add a force option for pciserial device · 9f0e46bf
      Feng Tang 提交于
      [ Upstream commit d2266bbfa9e3e32e3b642965088ca461bd24a94f ]
      
      The "pciserial" earlyprintk variant helps much on many modern x86
      platforms, but unfortunately there are still some platforms with PCI
      UART devices which have the wrong PCI class code. In that case, the
      current class code check does not allow for them to be used for logging.
      
      Add a sub-option "force" which overrides the class code check and thus
      the use of such device can be enforced.
      
       [ bp: massage formulations. ]
      Suggested-by: NBorislav Petkov <bp@alien8.de>
      Signed-off-by: NFeng Tang <feng.tang@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Stuart R . Anderson" <stuart.r.anderson@intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: H Peter Anvin <hpa@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thymo van Beers <thymovanbeers@gmail.com>
      Cc: alan@linux.intel.com
      Cc: linux-doc@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181002164921.25833-1-feng.tang@intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      9f0e46bf
    • Z
      apparmor: Fix uninitialized value in aa_split_fqname · c8a1685a
      Zubin Mithra 提交于
      [ Upstream commit 250f2da49cb8e582215a65c03f50e8ddf5cd119c ]
      
      Syzkaller reported a OOB-read with the stacktrace below. This occurs
      inside __aa_lookupn_ns as `n` is not initialized. `n` is obtained from
      aa_splitn_fqname. In cases where `name` is invalid, aa_splitn_fqname
      returns without initializing `ns_name` and `ns_len`.
      
      Fix this by always initializing `ns_name` and `ns_len`.
      
      	__dump_stack lib/dump_stack.c:77 [inline]
      	dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113
      	print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
      	kasan_report_error mm/kasan/report.c:354 [inline]
      	kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
      	__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
      	memcmp+0xe3/0x160 lib/string.c:861
      	strnstr+0x4b/0x70 lib/string.c:934
      	__aa_lookupn_ns+0xc1/0x570 security/apparmor/policy_ns.c:209
      	aa_lookupn_ns+0x88/0x1e0 security/apparmor/policy_ns.c:240
      	aa_fqlookupn_profile+0x1b9/0x1010 security/apparmor/policy.c:468
      	fqlookupn_profile+0x80/0xc0 security/apparmor/label.c:1844
      	aa_label_strn_parse+0xa3a/0x1230 security/apparmor/label.c:1908
      	aa_label_parse+0x42/0x50 security/apparmor/label.c:1943
      	aa_change_profile+0x513/0x3510 security/apparmor/domain.c:1362
      	apparmor_setprocattr+0xaa4/0x1150 security/apparmor/lsm.c:658
      	security_setprocattr+0x66/0xc0 security/security.c:1298
      	proc_pid_attr_write+0x301/0x540 fs/proc/base.c:2555
      	__vfs_write+0x119/0x9f0 fs/read_write.c:485
      	vfs_write+0x1fc/0x560 fs/read_write.c:549
      	ksys_write+0x101/0x260 fs/read_write.c:598
      	__do_sys_write fs/read_write.c:610 [inline]
      	__se_sys_write fs/read_write.c:607 [inline]
      	__x64_sys_write+0x73/0xb0 fs/read_write.c:607
      	do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
      	entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 3b0aaf58 ("apparmor: add lib fn to find the "split" for fqnames")
      Reported-by: syzbot+61e4b490d9d2da591b50@syzkaller.appspotmail.com
      Signed-off-by: NZubin Mithra <zsm@chromium.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c8a1685a
    • M
      clk: samsung: exynos5420: Enable PERIS clocks for suspend · 8b9cdb75
      Marek Szyprowski 提交于
      [ Upstream commit b33228029d842269e17bba591609e83ed422005d ]
      
      Ensure that clocks for core SoC modules (including TZPC0..9 modules)
      are enabled for suspend/resume cycle. This fixes suspend/resume
      support on Exynos5422-based Odroid XU3/XU4 boards.
      Suggested-by: NJoonyoung Shim <jy0922.shim@samsung.com>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NSylwester Nawrocki <snawrocki@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      8b9cdb75
    • C
      fs/exofs: fix potential memory leak in mount option parsing · 33df9177
      Chengguang Xu 提交于
      [ Upstream commit 515f1867addaba49c1c6ac73abfaffbc192c1db4 ]
      
      There are some cases can cause memory leak when parsing
      option 'osdname'.
      Signed-off-by: NChengguang Xu <cgxu519@gmx.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      33df9177
    • D
      perf symbols: Set PLT entry/header sizes properly on Sparc · b7d1a786
      David Miller 提交于
      [ Upstream commit d6afa561e1471ccfdaf7191230c0c59a37e45a5b ]
      
      Using the sh_entsize for both values isn't correct.  It happens to be
      correct on x86...
      
      For both 32-bit and 64-bit sparc, there are four PLT entries in the PLT
      section.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
      Cc: David Tolnay <dtolnay@gmail.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Li Bin <huawei.libin@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: zhangmengting@huawei.com
      Fixes: b2f76050 ("perf symbols: Fix plt entry calculation for ARM and AARCH64")
      Link: http://lkml.kernel.org/r/20181017.120859.2268840244308635255.davem@davemloft.netSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b7d1a786
    • A
      clk: fixed-rate: fix of_node_get-put imbalance · 070bbd57
      Alan Tull 提交于
      [ Upstream commit 52091c256bdcad0d01e2852a63f19cd2cce6af96 ]
      
      When the fixed rate clock is created by devicetree,
      of_clk_add_provider is called.  Add a call to
      of_clk_del_provider in the remove function to balance
      it out.
      Signed-off-by: NAlan Tull <atull@kernel.org>
      Fixes: 435779fe ("clk: fixed-rate: Convert into a module platform driver")
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      070bbd57
    • R
      platform/x86: intel_telemetry: report debugfs failure · c80506fa
      Rajneesh Bhardwaj 提交于
      [ Upstream commit 8d98b1ef368feeb7720b8b9b6f3bd93f2ad892bc ]
      
      On some Goldmont based systems such as ASRock J3455M the BIOS may not
      enable the IPC1 device that provides access to the PMC and PUNIT. In
      such scenarios, the IOSS and PSS resources from the platform device can
      not be obtained and result in a invalid telemetry_plt_config which is an
      internal data structure that holds platform config and is maintained by
      the telemetry platform driver.
      
      This is also applicable to the platforms where the BIOS supports IPC1
      device under debug configurations but IPC1 is disabled by user or the
      policy.
      
      This change allows user to know the reason for not seeing entries under
      /sys/kernel/debug/telemetry/* when there is no apparent failure at boot.
      
      Cc: Matt Turner <matt.turner@intel.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
      Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com>
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=198779Acked-by: NMatt Turner <matt.turner@intel.com>
      Signed-off-by: NRajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c80506fa
    • D
      afs: Handle EIO from delivery function · 464ac699
      David Howells 提交于
      [ Upstream commit 4ac15ea53622272c01954461b4814892b7481b40 ]
      
      Fix afs_deliver_to_call() to handle -EIO being returned by the operation
      delivery function, indicating that the call found itself in the wrong
      state, by printing an error and aborting the call.
      
      Currently, an assertion failure will occur.  This can happen, say, if the
      delivery function falls off the end without calling afs_extract_data() with
      the want_more parameter set to false to collect the end of the Rx phase of
      a call.
      
      The assertion failure looks like:
      
      	AFS: Assertion failed
      	4 == 7 is false
      	0x4 == 0x7 is false
      	------------[ cut here ]------------
      	kernel BUG at fs/afs/rxrpc.c:462!
      
      and is matched in the trace buffer by a line like:
      
      kworker/7:3-3226 [007] ...1 85158.030203: afs_io_error: c=0003be0c r=-5 CM_REPLY
      
      Fixes: 98bf40cd ("afs: Protect call->state changes against signals")
      Reported-by: NMarc Dionne <marc.dionne@auristor.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      464ac699
    • L
      drm/edid: Add 6 bpc quirk for BOE panel. · 6ea95033
      Lee, Shawn C 提交于
      [ Upstream commit 922dceff8dc1fb4dafc9af78139ba65671408103 ]
      
      BOE panel (ID: 0x0771) that reports "DFP 1.x compliant TMDS".
      But it's 6bpc panel only instead of 8 bpc.
      
      Add panel ID to edid quirk list and set 6 bpc as default to
      work around this issue.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: Cooper Chiou <cooper.chiou@intel.com>
      Signed-off-by: NLee, Shawn C <shawn.c.lee@intel.com&gt;>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/1540792173-7288-1-git-send-email-shawn.c.lee@intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      6ea95033
    • R
      um: Give start_idle_thread() a return code · d21e4ba3
      Richard Weinberger 提交于
      [ Upstream commit 7ff1e34bbdc15acab823b1ee4240e94623d50ee8 ]
      
      Fixes:
      arch/um/os-Linux/skas/process.c:613:1: warning: control reaches end of
      non-void function [-Wreturn-type]
      
      longjmp() never returns but gcc still warns that the end of the function
      can be reached.
      Add a return code and debug aid to detect this impossible case.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d21e4ba3
    • M
      perf unwind: Take pgoff into account when reporting elf to libdwfl · 6cddd650
      Milian Wolff 提交于
      [ Upstream commit 1fe627da30331024f453faef04d500079b901107 ]
      
      libdwfl parses an ELF file itself and creates mappings for the
      individual sections. perf on the other hand sees raw mmap events which
      represent individual sections. When we encounter an address pointing
      into a mapping with pgoff != 0, we must take that into account and
      report the file at the non-offset base address.
      
      This fixes unwinding with libdwfl in some cases. E.g. for a file like:
      
      ```
      
      using namespace std;
      
      mutex g_mutex;
      
      double worker()
      {
          lock_guard<mutex> guard(g_mutex);
          uniform_real_distribution<double> uniform(-1E5, 1E5);
          default_random_engine engine;
          double s = 0;
          for (int i = 0; i < 1000; ++i) {
              s += norm(complex<double>(uniform(engine), uniform(engine)));
          }
          cout << s << endl;
          return s;
      }
      
      int main()
      {
          vector<std::future<double>> results;
          for (int i = 0; i < 10000; ++i) {
              results.push_back(async(launch::async, worker));
          }
          return 0;
      }
      ```
      
      Compile it with `g++ -g -O2 -lpthread cpp-locking.cpp  -o cpp-locking`,
      then record it with `perf record --call-graph dwarf -e
      sched:sched_switch`.
      
      When you analyze it with `perf script` and libunwind, you should see:
      
      ```
      cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
                  7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
                  7f38e4252d0b arena_get2.part.4+0x2fb (/usr/lib/libc-2.28.so)
                  7f38e4255b1c tcache_init.part.6+0xec (/usr/lib/libc-2.28.so)
                  7f38e42569e5 __GI___libc_malloc+0x115 (inlined)
                  7f38e4241790 __GI__IO_file_doallocate+0x90 (inlined)
                  7f38e424fbbf __GI__IO_doallocbuf+0x4f (inlined)
                  7f38e424ee47 __GI__IO_file_overflow+0x197 (inlined)
                  7f38e424df36 _IO_new_file_xsputn+0x116 (inlined)
                  7f38e4242bfb __GI__IO_fwrite+0xdb (inlined)
                  7f38e463fa6d std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<c>
                  7f38e464bd70 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const+0x90 (inl>
                  7f38e464bd70 std::ostream& std::ostream::_M_insert<double>(double)+0x90 (/usr/lib/libstdc++.so.6.0.25)
                  563b9cb502f7 std::ostream::operator<<(double)+0xb7 (inlined)
                  563b9cb502f7 worker()+0xb7 (/ssd/milian/projects/kdab/rnd/hotspot/build/tests/test-clients/cpp-locking/cpp-locking)
                  563b9cb506fb double std::__invoke_impl<double, double (*)()>(std::__invoke_other, double (*&&)())+0x2b (inlined)
                  563b9cb506fb std::__invoke_result<double (*)()>::type std::__invoke<double (*)()>(double (*&&)())+0x2b (inlined)
                  563b9cb506fb decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<double (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>)+0x2b (inlined)
                  563b9cb506fb std::thread::_Invoker<std::tuple<double (*)()> >::operator()()+0x2b (inlined)
                  563b9cb506fb std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<double>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<double (*)()> >, dou>
                  563b9cb506fb std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_>
                  563b9cb507e8 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const+0x28 (inlined)
                  563b9cb507e8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)+0x28 (/ssd/milian/>
                  7f38e46d24fe __pthread_once_slow+0xbe (/usr/lib/libpthread-2.28.so)
                  563b9cb51149 __gthread_once+0xe9 (inlined)
                  563b9cb51149 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>
                  563b9cb51149 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool)+0xe9 (inlined)
                  563b9cb51149 std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double (*)()> >&&)::{lambda()#1}::op>
                  563b9cb51149 void std::__invoke_impl<void, std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double>
                  563b9cb51149 std::__invoke_result<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double (*)()> >>
                  563b9cb51149 decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_>
                  563b9cb51149 std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<dou>
                  563b9cb51149 std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread>
                  7f38e45f0062 execute_native_thread_routine+0x12 (/usr/lib/libstdc++.so.6.0.25)
                  7f38e46caa9c start_thread+0xfc (/usr/lib/libpthread-2.28.so)
                  7f38e42ccb22 __GI___clone+0x42 (inlined)
      ```
      
      Before this patch, using libdwfl, you would see:
      
      ```
      cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
                  7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
              a041161e77950c5c [unknown] ([unknown])
      ```
      
      With this patch applied, we get a bit further in unwinding:
      
      ```
      cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
                  7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
                  7f38e4252d0b arena_get2.part.4+0x2fb (/usr/lib/libc-2.28.so)
                  7f38e4255b1c tcache_init.part.6+0xec (/usr/lib/libc-2.28.so)
                  7f38e42569e5 __GI___libc_malloc+0x115 (inlined)
                  7f38e4241790 __GI__IO_file_doallocate+0x90 (inlined)
                  7f38e424fbbf __GI__IO_doallocbuf+0x4f (inlined)
                  7f38e424ee47 __GI__IO_file_overflow+0x197 (inlined)
                  7f38e424df36 _IO_new_file_xsputn+0x116 (inlined)
                  7f38e4242bfb __GI__IO_fwrite+0xdb (inlined)
                  7f38e463fa6d std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<c>
                  7f38e464bd70 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const+0x90 (inl>
                  7f38e464bd70 std::ostream& std::ostream::_M_insert<double>(double)+0x90 (/usr/lib/libstdc++.so.6.0.25)
                  563b9cb502f7 std::ostream::operator<<(double)+0xb7 (inlined)
                  563b9cb502f7 worker()+0xb7 (/ssd/milian/projects/kdab/rnd/hotspot/build/tests/test-clients/cpp-locking/cpp-locking)
              6eab825c1ee3e4ff [unknown] ([unknown])
      ```
      
      Note that the backtrace is still stopping too early, when compared to
      the nice results obtained via libunwind. It's unclear so far what the
      reason for that is.
      
      Committer note:
      
      Further comment by Milian on the thread started on the Link: tag below:
      
       ---
      The remaining issue is due to a bug in elfutils:
      
      https://sourceware.org/ml/elfutils-devel/2018-q4/msg00089.html
      
      With both patches applied, libunwind and elfutils produce the same output for
      the above scenario.
       ---
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20181029141644.3907-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      6cddd650
    • E
      hfsplus: prevent btree data loss on root split · 52fc49b6
      Ernesto A. Fernández 提交于
      [ Upstream commit 0a3021d4f5295aa073c7bf5c5e4de60a2e292578 ]
      
      Creating, renaming or deleting a file may cause catalog corruption and
      data loss.  This bug is randomly triggered by xfstests generic/027, but
      here is a faster reproducer:
      
        truncate -s 50M fs.iso
        mkfs.hfsplus fs.iso
        mount fs.iso /mnt
        i=100
        while [ $i -le 150 ]; do
          touch /mnt/$i &>/dev/null
          ((++i))
        done
        i=100
        while [ $i -le 150 ]; do
          mv /mnt/$i /mnt/$(perl -e "print $i x82") &>/dev/null
          ((++i))
        done
        umount /mnt
        fsck.hfsplus -n fs.iso
      
      The bug is triggered whenever hfs_brec_update_parent() needs to split the
      root node.  The height of the btree is not increased, which leaves the new
      node orphaned and its records lost.
      
      Link: http://lkml.kernel.org/r/26d882184fc43043a810114258f45277752186c7.1535682461.git.ernesto.mnd.fernandez@gmail.comSigned-off-by: NErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.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>
      52fc49b6
    • E
      hfs: prevent btree data loss on root split · ea54dce2
      Ernesto A. Fernández 提交于
      [ Upstream commit d057c036672f33d43a5f7344acbb08cf3a8a0c09 ]
      
      This bug is triggered whenever hfs_brec_update_parent() needs to split
      the root node.  The height of the btree is not increased, which leaves
      the new node orphaned and its records lost.  It is not possible for this
      to happen on a valid hfs filesystem because the index nodes have fixed
      length keys.
      
      For reasons I ignore, the hfs module does have support for a number of
      hfsplus features.  A corrupt btree header may report variable length
      keys and trigger this bug, so it's better to fix it.
      
      Link: http://lkml.kernel.org/r/9750b1415685c4adca10766895f6d5ef12babdb0.1535682463.git.ernesto.mnd.fernandez@gmail.comSigned-off-by: NErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.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>
      ea54dce2
    • J
      reiserfs: propagate errors from fill_with_dentries() properly · ee38053f
      Jann Horn 提交于
      [ Upstream commit b10298d56c9623f9b173f19959732d3184b35f4f ]
      
      fill_with_dentries() failed to propagate errors up to
      reiserfs_for_each_xattr() properly.  Plumb them through.
      
      Note that reiserfs_for_each_xattr() is only used by
      reiserfs_delete_xattrs() and reiserfs_chown_xattrs().  The result of
      reiserfs_delete_xattrs() is discarded anyway, the only difference there is
      whether a warning is printed to dmesg.  The result of
      reiserfs_chown_xattrs() does matter because it can block chowning of the
      file to which the xattrs belong; but either way, the resulting state can
      have misaligned ownership, so my patch doesn't improve things greatly.
      
      Credit for making me look at this code goes to Al Viro, who pointed out
      that the ->actor calling convention is suboptimal and should be changed.
      
      Link: http://lkml.kernel.org/r/20180802163335.83312-1-jannh@google.comSigned-off-by: NJann Horn <jannh@google.com>
      Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Jeff Mahoney <jeffm@suse.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      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>
      ee38053f
    • R
      ixgbe: fix MAC anti-spoofing filter after VFLR · 23ce028f
      Radoslaw Tyl 提交于
      [ Upstream commit 6702185c1ffec3421181b5e24491e3fac920cb61 ]
      
      This change resolves a driver bug where the driver is logging a
      message that says "Spoofed packets detected". This can occur on the PF
      (host) when a VF has VLAN+MACVLAN enabled and is re-started with a
      different MAC address.
      
      MAC and VLAN anti-spoofing filters are to be enabled together.
      Signed-off-by: NRadoslaw Tyl <radoslawx.tyl@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Acked-by: NPiotr Skajewski <piotrx.skajewski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      23ce028f
    • H
      net: hns3: bugfix for the initialization of command queue's spin lock · 91a52a44
      Huazhong Tan 提交于
      [ Upstream commit b2f74dbaf12bf59ff35d451005b3cdee78232ff0 ]
      
      The spin lock of the command queue only need to be initialized once
      when the driver initializes the command queue. It is not necessary to
      initialize the spin lock when resetting. At the same time, the
      modification of the queue member should be performed after acquiring
      the lock.
      
      Fixes: 3efb960f ("net: hns3: Refactor the initialization of command queue")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      91a52a44
    • H
      net: hns3: bugfix for handling mailbox while the command queue reinitialized · 355ec075
      Huazhong Tan 提交于
      [ Upstream commit 3c88ed1d798da355859ca083d3884a16ce0841f2 ]
      
      In a multi-core machine, the mailbox service and reset service
      will be executed at the same time. The reset service will re-initialize
      the command queue, before that, the mailbox handler can only get some
      invalid messages.
      
      The HCLGE_STATE_CMD_DISABLE flag means that the command queue is not
      available and needs to be reinitialized. Therefore, when the mailbox
      handler recognizes this flag, it should not process the command.
      
      Fixes: dde1a86e ("net: hns3: Add mailbox support to PF driver")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      355ec075
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclge_reset() · 92cb1b09
      Huazhong Tan 提交于
      [ Upstream commit a963052e539887df481d4d3a6ad4c92ca6461852 ]
      
      Since hclge_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclge_reset_wait(). So this patch releases the lock for the duration
      of hclge_reset_wait().
      
      Fixes: 6d4fab39 ("net: hns3: Reset net device with rtnl_lock")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      92cb1b09
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset() · 733edfd6
      Huazhong Tan 提交于
      [ Upstream commit 29118ab962d5476fdc65fae312ac38db68092d78 ]
      
      Since hclgevf_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclgevf_reset_wait(). So this patch releases the lock for the duration
      of hclgevf_reset_wait().
      
      Fixes: 6988eb2a ("net: hns3: Add support to reset the enet/ring mgmt layer")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      733edfd6
    • M
      block: brd: associate with queue until adding disk · 0987d5a6
      Ming Lei 提交于
      [ Upstream commit 153fcd5f6d93b8e1e4040b1337f564a10f8d93af ]
      
      brd_free() may be called in failure path on one brd instance which
      disk isn't added yet, so release handler of gendisk may free the
      associated request_queue early and causes the following use-after-free[1].
      
      This patch fixes this issue by associating gendisk with request_queue
      just before adding disk.
      
      [1] KASAN: use-after-free Read in del_timer_syncNon-volatile memory driver v1.3
      Linux agpgart interface v0.103
      [drm] Initialized vgem 1.0.0 20120112 for virtual device on minor 0
      usbcore: registered new interface driver udl
      ==================================================================
      BUG: KASAN: use-after-free in __lock_acquire+0x36d9/0x4c20
      kernel/locking/lockdep.c:3218
      Read of size 8 at addr ffff8801d1b6b540 by task swapper/0/1
      
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0+ #88
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Call Trace:
        __dump_stack lib/dump_stack.c:77 [inline]
        dump_stack+0x244/0x39d lib/dump_stack.c:113
        print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
        kasan_report_error mm/kasan/report.c:354 [inline]
        kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
        __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
        __lock_acquire+0x36d9/0x4c20 kernel/locking/lockdep.c:3218
        lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844
        del_timer_sync+0xb7/0x270 kernel/time/timer.c:1283
        blk_cleanup_queue+0x413/0x710 block/blk-core.c:809
        brd_free+0x5d/0x71 drivers/block/brd.c:422
        brd_init+0x2eb/0x393 drivers/block/brd.c:518
        do_one_initcall+0x145/0x957 init/main.c:890
        do_initcall_level init/main.c:958 [inline]
        do_initcalls init/main.c:966 [inline]
        do_basic_setup init/main.c:984 [inline]
        kernel_init_freeable+0x5c6/0x6b9 init/main.c:1148
        kernel_init+0x11/0x1ae init/main.c:1068
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:350
      
      Reported-by: syzbot+3701447012fe951dabb2@syzkaller.appspotmail.com
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0987d5a6
    • A
      arm64: kprobe: make page to RO mode when allocate it · 262522cc
      Anders Roxell 提交于
      [ Upstream commit 966866892cf89d606544bca22d584ba2ef9ec208 ]
      
      Commit 1404d6f1 ("arm64: dump: Add checking for writable and exectuable pages")
      has successfully identified code that leaves a page with W+X
      permissions.
      
      [    3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000
      [    3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420
      [    3.246141] Modules linked in:
      [    3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62
      [    3.247008] Hardware name: linux,dummy-virt (DT)
      [    3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [    3.247623] pc : note_page+0x410/0x420
      [    3.247898] lr : note_page+0x410/0x420
      [    3.248071] sp : ffff00000804bcd0
      [    3.248254] x29: ffff00000804bcd0 x28: ffff000009274000
      [    3.248578] x27: ffff00000921a000 x26: ffff80007dfff000
      [    3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a
      [    3.249109] x23: 0000000000000004 x22: ffff000000d91000
      [    3.249396] x21: ffff000000d90000 x20: 0000000000000000
      [    3.249661] x19: ffff00000804bde8 x18: 0000000000000400
      [    3.249924] x17: 0000000000000000 x16: 0000000000000000
      [    3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176
      [    3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461
      [    3.250941] x11: 20746120676e6970 x10: 70616d20582b5720
      [    3.251252] x9 : 6572756365736e69 x8 : 3039643030303030
      [    3.251519] x7 : 306666666678302f x6 : ffff0000095467b2
      [    3.251802] x5 : 0000000000000000 x4 : 0000000000000000
      [    3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff
      [    3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000
      [    3.252664] Call trace:
      [    3.252953]  note_page+0x410/0x420
      [    3.253186]  walk_pgd+0x12c/0x238
      [    3.253417]  ptdump_check_wx+0x68/0xf8
      [    3.253637]  mark_rodata_ro+0x68/0x98
      [    3.253847]  kernel_init+0x38/0x160
      [    3.254103]  ret_from_fork+0x10/0x18
      
      kprobes allocates a writable executable page with module_alloc() in
      order to store executable code.
      Reworked to that when allocate a page it sets mode RO. Inspired by
      commit 63fef14f ("kprobes/x86: Make insn buffer always ROX and use text_poke()").
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Suggested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NLaura Abbott <labbott@redhat.com>
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      [catalin.marinas@arm.com: removed unnecessary casts]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      262522cc