1. 26 7月, 2019 40 次提交
    • K
      perf/x86/amd/uncore: Set the thread mask for F17h L3 PMCs · 9854e068
      Kim Phillips 提交于
      commit 2f217d58a8a086d3399fecce39fb358848e799c4 upstream.
      
      Fill in the L3 performance event select register ThreadMask
      bitfield, to enable per hardware thread accounting.
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Gary Hook <Gary.Hook@amd.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Martin Liska <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pu Wen <puwen@hygon.cn>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Link: https://lkml.kernel.org/r/20190628215906.4276-2-kim.phillips@amd.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9854e068
    • K
      perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs · 82c46f7b
      Kim Phillips 提交于
      commit 16f4641166b10e199f0d7b68c2c5f004fef0bda3 upstream.
      
      The following commit:
      
        d7cbbe49 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events")
      
      enables L3 PMC events for all threads and slices by writing 1's in
      'ChL3PmcCfg' (L3 PMC PERF_CTL) register fields.
      
      Those bitfields overlap with high order event select bits in the Data
      Fabric PMC control register, however.
      
      So when a user requests raw Data Fabric events (-e amd_df/event=0xYYY/),
      the two highest order bits get inadvertently set, changing the counter
      select to events that don't exist, and for which no counts are read.
      
      This patch changes the logic to write the L3 masks only when dealing
      with L3 PMC counters.
      
      AMD Family 16h and below Northbridge (NB) counters were not affected.
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Gary Hook <Gary.Hook@amd.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Martin Liska <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Pu Wen <puwen@hygon.cn>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Fixes: d7cbbe49 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events")
      Link: https://lkml.kernel.org/r/20190628215906.4276-1-kim.phillips@amd.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82c46f7b
    • K
      perf/x86/intel: Fix spurious NMI on fixed counter · a847a522
      Kan Liang 提交于
      commit e4557c1a46b0d32746bd309e1941914b5a6912b4 upstream.
      
      If a user first sample a PEBS event on a fixed counter, then sample a
      non-PEBS event on the same fixed counter on Icelake, it will trigger
      spurious NMI. For example:
      
        perf record -e 'cycles:p' -a
        perf record -e 'cycles' -a
      
      The error message for spurious NMI:
      
        [June 21 15:38] Uhhuh. NMI received for unknown reason 30 on CPU 2.
        [    +0.000000] Do you have a strange power saving mode enabled?
        [    +0.000000] Dazed and confused, but trying to continue
      
      The bug was introduced by the following commit:
      
        commit 6f55967ad9d9 ("perf/x86/intel: Fix race in intel_pmu_disable_event()")
      
      The commit moves the intel_pmu_pebs_disable() after intel_pmu_disable_fixed(),
      which returns immediately.  The related bit of PEBS_ENABLE MSR will never be
      cleared for the fixed counter. Then a non-PEBS event runs on the fixed counter,
      but the bit on PEBS_ENABLE is still set, which triggers spurious NMIs.
      
      Check and disable PEBS for fixed counters after intel_pmu_disable_fixed().
      Reported-by: NYi, Ammy <ammy.yi@intel.com>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Fixes: 6f55967ad9d9 ("perf/x86/intel: Fix race in intel_pmu_disable_event()")
      Link: https://lkml.kernel.org/r/20190625142135.22112-1-kan.liang@linux.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a847a522
    • D
      x86/boot: Fix memory leak in default_get_smp_config() · 0d4c0bb7
      David Rientjes 提交于
      commit e74bd96989dd42a51a73eddb4a5510a6f5e42ac3 upstream.
      
      When default_get_smp_config() is called with early == 1 and mpf->feature1
      is non-zero, mpf is leaked because the return path does not do
      early_memunmap().
      
      Fix this and share a common exit routine.
      
      Fixes: 5997efb9 ("x86/boot: Use memremap() to map the MPF and MPC data")
      Reported-by: NCfir Cohen <cfir@google.com>
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1907091942570.28240@chino.kir.corp.google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d4c0bb7
    • Y
      9p/virtio: Add cleanup path in p9_virtio_init · b52807e6
      YueHaibing 提交于
      commit d4548543fc4ece56c6f04b8586f435fb4fd84c20 upstream.
      
      KASAN report this:
      
      BUG: unable to handle kernel paging request at ffffffffa0097000
      PGD 3870067 P4D 3870067 PUD 3871063 PMD 2326e2067 PTE 0
      Oops: 0000 [#1
      CPU: 0 PID: 5340 Comm: modprobe Not tainted 5.1.0-rc7+ #25
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
      RIP: 0010:__list_add_valid+0x10/0x70
      Code: c3 48 8b 06 55 48 89 e5 5d 48 39 07 0f 94 c0 0f b6 c0 c3 90 90 90 90 90 90 90 55 48 89 d0 48 8b 52 08 48 89 e5 48 39 f2 75 19 <48> 8b 32 48 39 f0 75 3a
      
      RSP: 0018:ffffc90000e23c68 EFLAGS: 00010246
      RAX: ffffffffa00ad000 RBX: ffffffffa009d000 RCX: 0000000000000000
      RDX: ffffffffa0097000 RSI: ffffffffa0097000 RDI: ffffffffa009d000
      RBP: ffffc90000e23c68 R08: 0000000000000001 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa0097000
      R13: ffff888231797180 R14: 0000000000000000 R15: ffffc90000e23e78
      FS:  00007fb215285540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffffffa0097000 CR3: 000000022f144000 CR4: 00000000000006f0
      Call Trace:
       v9fs_register_trans+0x2f/0x60 [9pnet
       ? 0xffffffffa0087000
       p9_virtio_init+0x25/0x1000 [9pnet_virtio
       do_one_initcall+0x6c/0x3cc
       ? kmem_cache_alloc_trace+0x248/0x3b0
       do_init_module+0x5b/0x1f1
       load_module+0x1db1/0x2690
       ? m_show+0x1d0/0x1d0
       __do_sys_finit_module+0xc5/0xd0
       __x64_sys_finit_module+0x15/0x20
       do_syscall_64+0x6b/0x1d0
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x7fb214d8e839
      Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01
      
      RSP: 002b:00007ffc96554278 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      RAX: ffffffffffffffda RBX: 000055e67eed2aa0 RCX: 00007fb214d8e839
      RDX: 0000000000000000 RSI: 000055e67ce95c2e RDI: 0000000000000003
      RBP: 000055e67ce95c2e R08: 0000000000000000 R09: 000055e67eed2aa0
      R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
      R13: 000055e67eeda500 R14: 0000000000040000 R15: 000055e67eed2aa0
      Modules linked in: 9pnet_virtio(+) 9pnet gre rfkill vmw_vsock_virtio_transport_common vsock [last unloaded: 9pnet_virtio
      CR2: ffffffffa0097000
      ---[ end trace 4a52bb13ff07b761
      
      If register_virtio_driver() fails in p9_virtio_init,
      we should call v9fs_unregister_trans() to do cleanup.
      
      Link: http://lkml.kernel.org/r/20190430115942.41840-1-yuehaibing@huawei.com
      Cc: stable@vger.kernel.org
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Fixes: b530cc79 ("9p: add virtio transport")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b52807e6
    • Y
      9p/xen: Add cleanup path in p9_trans_xen_init · 1253882d
      YueHaibing 提交于
      commit 80a316ff16276b36d0392a8f8b2f63259857ae98 upstream.
      
      If xenbus_register_frontend() fails in p9_trans_xen_init,
      we should call v9fs_unregister_trans() to do cleanup.
      
      Link: http://lkml.kernel.org/r/20190430143933.19368-1-yuehaibing@huawei.com
      Cc: stable@vger.kernel.org
      Fixes: 868eb122 ("xen/9pfs: introduce Xen 9pfs transport driver")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDominique Martinet <dominique.martinet@cea.fr>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1253882d
    • J
      xen/events: fix binding user event channels to cpus · 007e5aaf
      Juergen Gross 提交于
      commit bce5963bcb4f9934faa52be323994511d59fd13c upstream.
      
      When binding an interdomain event channel to a vcpu via
      IOCTL_EVTCHN_BIND_INTERDOMAIN not only the event channel needs to be
      bound, but the affinity of the associated IRQi must be changed, too.
      Otherwise the IRQ and the event channel won't be moved to another vcpu
      in case the original vcpu they were bound to is going offline.
      
      Cc: <stable@vger.kernel.org> # 4.13
      Fixes: c48f64ab ("xen-evtchn: Bind dyn evtchn:qemu-dm interrupt to next online VCPU")
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      007e5aaf
    • D
      dm zoned: fix zone state management race · e380170b
      Damien Le Moal 提交于
      commit 3b8cafdd5436f9298b3bf6eb831df5eef5ee82b6 upstream.
      
      dm-zoned uses the zone flag DMZ_ACTIVE to indicate that a zone of the
      backend device is being actively read or written and so cannot be
      reclaimed. This flag is set as long as the zone atomic reference
      counter is not 0. When this atomic is decremented and reaches 0 (e.g.
      on BIO completion), the active flag is cleared and set again whenever
      the zone is reused and BIO issued with the atomic counter incremented.
      These 2 operations (atomic inc/dec and flag set/clear) are however not
      always executed atomically under the target metadata mutex lock and
      this causes the warning:
      
      WARN_ON(!test_bit(DMZ_ACTIVE, &zone->flags));
      
      in dmz_deactivate_zone() to be displayed. This problem is regularly
      triggered with xfstests generic/209, generic/300, generic/451 and
      xfs/077 with XFS being used as the file system on the dm-zoned target
      device. Similarly, xfstests ext4/303, ext4/304, generic/209 and
      generic/300 trigger the warning with ext4 use.
      
      This problem can be easily fixed by simply removing the DMZ_ACTIVE flag
      and managing the "ACTIVE" state by directly looking at the reference
      counter value. To do so, the functions dmz_activate_zone() and
      dmz_deactivate_zone() are changed to inline functions respectively
      calling atomic_inc() and atomic_dec(), while the dmz_is_active() macro
      is changed to an inline function calling atomic_read().
      
      Fixes: 3b1a94c8 ("dm zoned: drive-managed zoned block device target")
      Cc: stable@vger.kernel.org
      Reported-by: NMasato Suzuki <masato.suzuki@wdc.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e380170b
    • D
      padata: use smp_mb in padata_reorder to avoid orphaned padata jobs · 1e4247d7
      Daniel Jordan 提交于
      commit cf144f81a99d1a3928f90b0936accfd3f45c9a0a upstream.
      
      Testing padata with the tcrypt module on a 5.2 kernel...
      
          # modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
          # modprobe tcrypt mode=211 sec=1
      
      ...produces this splat:
      
          INFO: task modprobe:10075 blocked for more than 120 seconds.
                Not tainted 5.2.0-base+ #16
          modprobe        D    0 10075  10064 0x80004080
          Call Trace:
           ? __schedule+0x4dd/0x610
           ? ring_buffer_unlock_commit+0x23/0x100
           schedule+0x6c/0x90
           schedule_timeout+0x3b/0x320
           ? trace_buffer_unlock_commit_regs+0x4f/0x1f0
           wait_for_common+0x160/0x1a0
           ? wake_up_q+0x80/0x80
           { crypto_wait_req }             # entries in braces added by hand
           { do_one_aead_op }
           { test_aead_jiffies }
           test_aead_speed.constprop.17+0x681/0xf30 [tcrypt]
           do_test+0x4053/0x6a2b [tcrypt]
           ? 0xffffffffa00f4000
           tcrypt_mod_init+0x50/0x1000 [tcrypt]
           ...
      
      The second modprobe command never finishes because in padata_reorder,
      CPU0's load of reorder_objects is executed before the unlocking store in
      spin_unlock_bh(pd->lock), causing CPU0 to miss CPU1's increment:
      
      CPU0                                 CPU1
      
      padata_reorder                       padata_do_serial
        LOAD reorder_objects  // 0
                                             INC reorder_objects  // 1
                                             padata_reorder
                                               TRYLOCK pd->lock   // failed
        UNLOCK pd->lock
      
      CPU0 deletes the timer before returning from padata_reorder and since no
      other job is submitted to padata, modprobe waits indefinitely.
      
      Add a pair of full barriers to guarantee proper ordering:
      
      CPU0                                 CPU1
      
      padata_reorder                       padata_do_serial
        UNLOCK pd->lock
        smp_mb()
        LOAD reorder_objects
                                             INC reorder_objects
                                             smp_mb__after_atomic()
                                             padata_reorder
                                               TRYLOCK pd->lock
      
      smp_mb__after_atomic is needed so the read part of the trylock operation
      comes after the INC, as Andrea points out.   Thanks also to Andrea for
      help with writing a litmus test.
      
      Fixes: 16295bec ("padata: Generic parallelization/serialization interface")
      Signed-off-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: <stable@vger.kernel.org>
      Cc: Andrea Parri <andrea.parri@amarulasolutions.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Paul E. McKenney <paulmck@linux.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e4247d7
    • L
      drm/nouveau/i2c: Enable i2c pads & busses during preinit · 0489d808
      Lyude Paul 提交于
      commit 7cb95eeea6706c790571042a06782e378b2561ea upstream.
      
      It turns out that while disabling i2c bus access from software when the
      GPU is suspended was a step in the right direction with:
      
      commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after
      ->fini()")
      
      We also ended up accidentally breaking the vbios init scripts on some
      older Tesla GPUs, as apparently said scripts can actually use the i2c
      bus. Since these scripts are executed before initializing any
      subdevices, we end up failing to acquire access to the i2c bus which has
      left a number of cards with their fan controllers uninitialized. Luckily
      this doesn't break hardware - it just means the fan gets stuck at 100%.
      
      This also means that we've always been using our i2c busses before
      initializing them during the init scripts for older GPUs, we just didn't
      notice it until we started preventing them from being used until init.
      It's pretty impressive this never caused us any issues before!
      
      So, fix this by initializing our i2c pad and busses during subdev
      pre-init. We skip initializing aux busses during pre-init, as those are
      guaranteed to only ever be used by nouveau for DP aux transactions.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Tested-by: NMarc Meledandri <m.meledandri@gmail.com>
      Fixes: 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after ->fini()")
      Cc: stable@vger.kernel.org
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0489d808
    • M
      kconfig: fix missing choice values in auto.conf · c77cbc87
      Masahiro Yamada 提交于
      commit 8e2442a5f86e1f77b86401fce274a7f622740bc4 upstream.
      
      Since commit 00c864f8 ("kconfig: allow all config targets to write
      auto.conf if missing"), Kconfig creates include/config/auto.conf in the
      defconfig stage when it is missing.
      
      Joonas Kylmälä reported incorrect auto.conf generation under some
      circumstances.
      
      To reproduce it, apply the following diff:
      
      |  --- a/arch/arm/configs/imx_v6_v7_defconfig
      |  +++ b/arch/arm/configs/imx_v6_v7_defconfig
      |  @@ -345,14 +345,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y
      |   CONFIG_USB_CONFIGFS_F_HID=y
      |   CONFIG_USB_CONFIGFS_F_UVC=y
      |   CONFIG_USB_CONFIGFS_F_PRINTER=y
      |  -CONFIG_USB_ZERO=m
      |  -CONFIG_USB_AUDIO=m
      |  -CONFIG_USB_ETH=m
      |  -CONFIG_USB_G_NCM=m
      |  -CONFIG_USB_GADGETFS=m
      |  -CONFIG_USB_FUNCTIONFS=m
      |  -CONFIG_USB_MASS_STORAGE=m
      |  -CONFIG_USB_G_SERIAL=m
      |  +CONFIG_USB_FUNCTIONFS=y
      |   CONFIG_MMC=y
      |   CONFIG_MMC_SDHCI=y
      |   CONFIG_MMC_SDHCI_PLTFM=y
      
      And then, run:
      
      $ make ARCH=arm mrproper imx_v6_v7_defconfig
      
      You will see CONFIG_USB_FUNCTIONFS=y is correctly contained in the
      .config, but not in the auto.conf.
      
      Please note drivers/usb/gadget/legacy/Kconfig is included from a choice
      block in drivers/usb/gadget/Kconfig. So USB_FUNCTIONFS is a choice value.
      
      This is probably a similar situation described in commit beaaddb6
      ("kconfig: tests: test defconfig when two choices interact").
      
      When sym_calc_choice() is called, the choice symbol forgets the
      SYMBOL_DEF_USER unless all of its choice values are explicitly set by
      the user.
      
      The choice symbol is given just one chance to recall it because
      set_all_choice_values() is called if SYMBOL_NEED_SET_CHOICE_VALUES
      is set.
      
      When sym_calc_choice() is called again, the choice symbol forgets it
      forever, since SYMBOL_NEED_SET_CHOICE_VALUES is a one-time aid.
      Hence, we cannot call sym_clear_all_valid() again and again.
      
      It is crazy to repeat set and unset of internal flags. However, we
      cannot simply get rid of "sym->flags &= flags | ~SYMBOL_DEF_USER;"
      Doing so would re-introduce the problem solved by commit 5d09598d
      ("kconfig: fix new choices being skipped upon config update").
      
      To work around the issue, conf_write_autoconf() stopped calling
      sym_clear_all_valid().
      
      conf_write() must be changed accordingly. Currently, it clears
      SYMBOL_WRITE after the symbol is written into the .config file. This
      is needed to prevent it from writing the same symbol multiple times in
      case the symbol is declared in two or more locations. I added the new
      flag SYMBOL_WRITTEN, to track the symbols that have been written.
      
      Anyway, this is a cheesy workaround in order to suppress the issue
      as far as defconfig is concerned.
      
      Handling of choices is totally broken. sym_clear_all_valid() is called
      every time a user touches a symbol from the GUI interface. To reproduce
      it, just add a new symbol drivers/usb/gadget/legacy/Kconfig, then touch
      around unrelated symbols from menuconfig. USB_FUNCTIONFS will disappear
      from the .config file.
      
      I added the Fixes tag since it is more fatal than before. But, this
      has been broken since long long time before, and still it is.
      We should take a closer look to fix this correctly somehow.
      
      Fixes: 00c864f8 ("kconfig: allow all config targets to write auto.conf if missing")
      Cc: linux-stable <stable@vger.kernel.org> # 4.19+
      Reported-by: NJoonas Kylmälä <joonas.kylmala@iki.fi>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NJoonas Kylmälä <joonas.kylmala@iki.fi>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c77cbc87
    • R
      fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes. · 2c7b50c7
      Radoslaw Burny 提交于
      commit 5ec27ec735ba0477d48c80561cc5e856f0c5dfaf upstream.
      
      Normally, the inode's i_uid/i_gid are translated relative to s_user_ns,
      but this is not a correct behavior for proc.  Since sysctl permission
      check in test_perm is done against GLOBAL_ROOT_[UG]ID, it makes more
      sense to use these values in u_[ug]id of proc inodes.  In other words:
      although uid/gid in the inode is not read during test_perm, the inode
      logically belongs to the root of the namespace.  I have confirmed this
      with Eric Biederman at LPC and in this thread:
        https://lore.kernel.org/lkml/87k1kzjdff.fsf@xmission.com
      
      Consequences
      ============
      
      Since the i_[ug]id values of proc nodes are not used for permissions
      checks, this change usually makes no functional difference.  However, it
      causes an issue in a setup where:
      
       * a namespace container is created without root user in container -
         hence the i_[ug]id of proc nodes are set to INVALID_[UG]ID
      
       * container creator tries to configure it by writing /proc/sys files,
         e.g. writing /proc/sys/kernel/shmmax to configure shared memory limit
      
      Kernel does not allow to open an inode for writing if its i_[ug]id are
      invalid, making it impossible to write shmmax and thus - configure the
      container.
      
      Using a container with no root mapping is apparently rare, but we do use
      this configuration at Google.  Also, we use a generic tool to configure
      the container limits, and the inability to write any of them causes a
      failure.
      
      History
      =======
      
      The invalid uids/gids in inodes first appeared due to 81754357 (fs:
      Update i_[ug]id_(read|write) to translate relative to s_user_ns).
      However, AFAIK, this did not immediately cause any issues.  The
      inability to write to these "invalid" inodes was only caused by a later
      commit 0bd23d09 (vfs: Don't modify inodes with a uid or gid unknown
      to the vfs).
      
      Tested: Used a repro program that creates a user namespace without any
      mapping and stat'ed /proc/$PID/root/proc/sys/kernel/shmmax from outside.
      Before the change, it shows the overflow uid, with the change it's 0.
      The overflow uid indicates that the uid in the inode is not correct and
      thus it is not possible to open the file for writing.
      
      Link: http://lkml.kernel.org/r/20190708115130.250149-1-rburny@google.com
      Fixes: 0bd23d09 ("vfs: Don't modify inodes with a uid or gid unknown to the vfs")
      Signed-off-by: NRadoslaw Burny <rburny@google.com>
      Acked-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: "Eric W . Biederman" <ebiederm@xmission.com>
      Cc: Seth Forshee <seth.forshee@canonical.com>
      Cc: John Sperbeck <jsperbeck@google.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: <stable@vger.kernel.org>	[4.8+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c7b50c7
    • J
      arm64: tegra: Fix AGIC register range · ba271659
      Jon Hunter 提交于
      commit ba24eee6686f6ed3738602b54d959253316a9541 upstream.
      
      The Tegra AGIC interrupt controller is an ARM GIC400 interrupt
      controller. Per the ARM GIC device-tree binding, the first address
      region is for the GIC distributor registers and the second address
      region is for the GIC CPU interface registers. The address space for
      the distributor registers is 4kB, but currently this is incorrectly
      defined as 8kB for the Tegra AGIC and overlaps with the CPU interface
      registers. Correct the address space for the distributor to be 4kB.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Fixes: bcdbde43 ("arm64: tegra: Add AGIC node for Tegra210")
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba271659
    • L
      KVM: x86/vPMU: refine kvm_pmu err msg when event creation failed · ba27a25d
      Like Xu 提交于
      commit 6fc3977ccc5d3c22e851f2dce2d3ce2a0a843842 upstream.
      
      If a perf_event creation fails due to any reason of the host perf
      subsystem, it has no chance to log the corresponding event for guest
      which may cause abnormal sampling data in guest result. In debug mode,
      this message helps to understand the state of vPMC and we may not
      limit the number of occurrences but not in a spamming style.
      Suggested-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NLike Xu <like.xu@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba27a25d
    • S
      media: videobuf2-dma-sg: Prevent size from overflowing · 87bae91a
      Sakari Ailus 提交于
      commit 14f28f5cea9e3998442de87846d1907a531b6748 upstream.
      
      buf->size is an unsigned long; casting that to int will lead to an
      overflow if buf->size exceeds INT_MAX.
      
      Fix this by changing the type to unsigned long instead. This is possible
      as the buf->size is always aligned to PAGE_SIZE, and therefore the size
      will never have values lesser than 0.
      
      Note on backporting to stable: the file used to be under
      drivers/media/v4l2-core, it was moved to the current location after 4.14.
      Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87bae91a
    • S
      media: videobuf2-core: Prevent size alignment wrapping buffer size to 0 · cb2e2b0a
      Sakari Ailus 提交于
      commit defcdc5d89ced780fb45196d539d6570ec5b1ba5 upstream.
      
      PAGE_ALIGN() may wrap the buffer size around to 0. Prevent this by
      checking that the aligned value is not smaller than the unaligned one.
      
      Note on backporting to stable: the file used to be under
      drivers/media/v4l2-core, it was moved to the current location after 4.14.
      Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb2e2b0a
    • E
      media: coda: Remove unbalanced and unneeded mutex unlock · deb78bd2
      Ezequiel Garcia 提交于
      commit 766b9b168f6c75c350dd87c3e0bc6a9b322f0013 upstream.
      
      The mutex unlock in the threaded interrupt handler is not paired
      with any mutex lock. Remove it.
      
      This bug has been here for a really long time, so it applies
      to any stable repo.
      Reviewed-by: NPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: NEzequiel Garcia <ezequiel@collabora.com>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      deb78bd2
    • B
      media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom() · fc0232e2
      Boris Brezillon 提交于
      commit 07d89227a983df957a6a7c56f7c040cde9ac571f upstream.
      
      cfg->type can be overridden by v4l2_ctrl_fill() and the new value is
      stored in the local type var. Fix the tests to use this local var.
      
      Fixes: 0996517c ("V4L/DVB: v4l2: Add new control handling framework")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NBoris Brezillon <boris.brezillon@collabora.com>
      [hverkuil-cisco@xs4all.nl: change to !qmenu and !qmenu_int (checkpatch)]
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc0232e2
    • H
      ALSA: hda/realtek: apply ALC891 headset fixup to one Dell machine · a4c4c06f
      Hui Wang 提交于
      commit 4b4e0e32e4b09274dbc9d173016c1a026f44608c upstream.
      
      Without this patch, the headset-mic and headphone-mic don't work.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NHui Wang <hui.wang@canonical.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4c4c06f
    • K
      ALSA: hda/realtek - Fixed Headphone Mic can't record on Dell platform · 8ba78e4d
      Kailang Yang 提交于
      commit fbc571290d9f7bfe089c50f4ac4028dd98ebfe98 upstream.
      
      It assigned to wrong model. So, The headphone Mic can't work.
      
      Fixes: 3f640970 ("ALSA: hda - Fix headset mic detection problem for several Dell laptops")
      Signed-off-by: NKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ba78e4d
    • T
      ALSA: seq: Break too long mutex context in the write loop · c92212a8
      Takashi Iwai 提交于
      commit ede34f397ddb063b145b9e7d79c6026f819ded13 upstream.
      
      The fix for the racy writes and ioctls to sequencer widened the
      application of client->ioctl_mutex to the whole write loop.  Although
      it does unlock/relock for the lengthy operation like the event dup,
      the loop keeps the ioctl_mutex for the whole time in other
      situations.  This may take quite long time if the user-space would
      give a huge buffer, and this is a likely cause of some weird behavior
      spotted by syzcaller fuzzer.
      
      This patch puts a simple workaround, just adding a mutex break in the
      loop when a large number of events have been processed.  This
      shouldn't hit any performance drop because the threshold is set high
      enough for usual operations.
      
      Fixes: 7bd80091 ("ALSA: seq: More protection for concurrent write and ioctl races")
      Reported-by: syzbot+97aae04ce27e39cbfca9@syzkaller.appspotmail.com
      Reported-by: syzbot+4c595632b98bb8ffcc66@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c92212a8
    • X
      raid5-cache: Need to do start() part job after adding journal device · eb6c84e4
      Xiao Ni 提交于
      commit d9771f5ec46c282d518b453c793635dbdc3a2a94 upstream.
      
      commit d5d885fd ("md: introduce new personality funciton start()")
      splits the init job to two parts. The first part run() does the jobs that
      do not require the md threads. The second part start() does the jobs that
      require the md threads.
      
      Now it just does run() in adding new journal device. It needs to do the
      second part start() too.
      
      Fixes: d5d885fd ("md: introduce new personality funciton start()")
      Cc: stable@vger.kernel.org #v4.9+
      Reported-by: NMichal Soltys <soltys@ziu.info>
      Signed-off-by: NXiao Ni <xni@redhat.com>
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb6c84e4
    • M
      ASoC: dapm: Adapt for debugfs API change · 3f42c000
      Mark Brown 提交于
      commit ceaea851b9ea75f9ea2bbefb53ff0d4b27cd5a6e upstream.
      
      Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the
      debugfs APIs were changed to return error pointers rather than NULL
      pointers on error, breaking the error checking in ASoC. Update the
      code to use IS_ERR() and log the codes that are returned as part of
      the error messages.
      
      Fixes: ff9fb72bc07705c (debugfs: return error values, not NULL)
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f42c000
    • C
      lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE · 677b2aa3
      Christophe Leroy 提交于
      commit aeb87246537a83c2aff482f3f34a2e0991e02cbc upstream.
      
      All mapping iterator logic is based on the assumption that sg->offset
      is always lower than PAGE_SIZE.
      
      But there are situations where sg->offset is such that the SG item
      is on the second page. In that case sg_copy_to_buffer() fails
      properly copying the data into the buffer. One of the reason is
      that the data will be outside the kmapped area used to access that
      data.
      
      This patch fixes the issue by adjusting the mapping iterator
      offset and pgoffset fields such that offset is always lower than
      PAGE_SIZE.
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Fixes: 4225fc85 ("lib/scatterlist: use page iterator in the mapping iterator")
      Cc: stable@vger.kernel.org
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      677b2aa3
    • T
      pnfs: Fix a problem where we gratuitously start doing I/O through the MDS · 0b174bac
      Trond Myklebust 提交于
      commit 58bbeab425c6c5e318f5b6ae31d351331ddfb34b upstream.
      
      If the client has to stop in pnfs_update_layout() to wait for another
      layoutget to complete, it currently exits and defaults to I/O through
      the MDS if the layoutget was successful.
      
      Fixes: d03360aa ("pNFS: Ensure we return the error if someone kills...")
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      Cc: stable@vger.kernel.org # v4.20+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b174bac
    • T
      pNFS: Fix a typo in pnfs_update_layout · f64ff591
      Trond Myklebust 提交于
      commit 400417b05f3ec0531544ca5f94e64d838d8b8849 upstream.
      
      We're supposed to wait for the outstanding layout count to go to zero,
      but that got lost somehow.
      
      Fixes: d03360aa ("pNFS: Ensure we return the error if someone...")
      Reported-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f64ff591
    • T
      pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error · 603e7497
      Trond Myklebust 提交于
      commit 8e04fdfadda75a849c649f7e50fe7d97772e1fcb upstream.
      
      mirror->mirror_ds can be NULL if uninitialised, but can contain
      a PTR_ERR() if call to GETDEVICEINFO failed.
      
      Fixes: 65990d1a ("pNFS/flexfiles: Fix a deadlock on LAYOUTGET")
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      Cc: stable@vger.kernel.org # 4.10+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      603e7497
    • T
      NFSv4: Handle the special Linux file open access mode · 5347e619
      Trond Myklebust 提交于
      commit 44942b4e457beda00981f616402a1a791e8c616e upstream.
      
      According to the open() manpage, Linux reserves the access mode 3
      to mean "check for read and write permission on the file and return
      a file descriptor that can't be used for reading or writing."
      
      Currently, the NFSv4 code will ask the server to open the file,
      and will use an incorrect share access mode of 0. Since it has
      an incorrect share access mode, the client later forgets to send
      a corresponding close, meaning it can leak stateids on the server.
      
      Fixes: ce4ef7c0 ("NFS: Split out NFS v4 file operations")
      Cc: stable@vger.kernel.org # 3.6+
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5347e619
    • E
      iwlwifi: fix RF-Kill interrupt while FW load for gen2 devices · 6825ff01
      Emmanuel Grumbach 提交于
      commit ed3e4c6d3cd8f093a3636cb05492429fe2af228d upstream.
      
      Newest devices have a new firmware load mechanism. This
      mechanism is called the context info. It means that the
      driver doesn't need to load the sections of the firmware.
      The driver rather prepares a place in DRAM, with pointers
      to the relevant sections of the firmware, and the firmware
      loads itself.
      At the end of the process, the firmware sends the ALIVE
      interrupt. This is different from the previous scheme in
      which the driver expected the FH_TX interrupt after each
      section being transferred over the DMA.
      
      In order to support this new flow, we enabled all the
      interrupts. This broke the assumption that we have in the
      code that the RF-Kill interrupt can't interrupt the firmware
      load flow.
      
      Change the context info flow to enable only the ALIVE
      interrupt, and re-enable all the other interrupts only
      after the firmware is alive. Then, we won't see the RF-Kill
      interrupt until then. Getting the RF-Kill interrupt while
      loading the firmware made us kill the firmware while it is
      loading and we ended up dumping garbage instead of the firmware
      state.
      
      Re-enable the ALIVE | RX interrupts from the ISR when we
      get the ALIVE interrupt to be able to get the RX interrupt
      that comes immediately afterwards for the ALIVE
      notification. This is needed for non MSI-X only.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6825ff01
    • E
      iwlwifi: don't WARN when calling iwl_get_shared_mem_conf with RF-Kill · a32e2cec
      Emmanuel Grumbach 提交于
      commit 0d53cfd0cca3c729a089c39eef0e7d8ae7662974 upstream.
      
      iwl_mvm_send_cmd returns 0 when the command won't be sent
      because RF-Kill is asserted. Do the same when we call
      iwl_get_shared_mem_conf since it is not sent through
      iwl_mvm_send_cmd but directly calls the transport layer.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a32e2cec
    • E
      iwlwifi: pcie: fix ALIVE interrupt handling for gen2 devices w/o MSI-X · d9ce0788
      Emmanuel Grumbach 提交于
      commit ec46ae30245ecb41d73f8254613db07c653fb498 upstream.
      
      We added code to restock the buffer upon ALIVE interrupt
      when MSI-X is disabled. This was added as part of the context
      info code. This code was added only if the ISR debug level
      is set which is very unlikely to be related.
      Move this code to run even when the ISR debug level is not
      set.
      
      Note that gen2 devices work with MSI-X in most cases so that
      this path is seldom used.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9ce0788
    • E
      iwlwifi: pcie: don't service an interrupt that was masked · 04c52c10
      Emmanuel Grumbach 提交于
      commit 3b57a10ca14c619707398dc58fe5ece18c95b20b upstream.
      
      Sometimes the register status can include interrupts that
      were masked. We can, for example, get the RF-Kill bit set
      in the interrupt status register although this interrupt
      was masked. Then if we get the ALIVE interrupt (for example)
      that was not masked, we need to *not* service the RF-Kill
      interrupt.
      Fix this in the MSI-X interrupt handler.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04c52c10
    • J
      arm64: tegra: Update Jetson TX1 GPU regulator timings · 7ebddd5f
      Jon Hunter 提交于
      commit ece6031ece2dd64d63708cfe1088016cee5b10c0 upstream.
      
      The GPU regulator enable ramp delay for Jetson TX1 is set to 1ms which
      not sufficient because the enable ramp delay has been measured to be
      greater than 1ms. Furthermore, the downstream kernels released by NVIDIA
      for Jetson TX1 are using a enable ramp delay 2ms and a settling delay of
      160us. Update the GPU regulator enable ramp delay for Jetson TX1 to be
      2ms and add a settling delay of 160us.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Fixes: 5e6b9a89 ("arm64: tegra: Add VDD_GPU regulator to Jetson TX1")
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ebddd5f
    • K
      regulator: s2mps11: Fix buck7 and buck8 wrong voltages · 042451b9
      Krzysztof Kozlowski 提交于
      commit 16da0eb5ab6ef2dd1d33431199126e63db9997cc upstream.
      
      On S2MPS11 device, the buck7 and buck8 regulator voltages start at 750
      mV, not 600 mV.  Using wrong minimal value caused shifting of these
      regulator values by 150 mV (e.g. buck7 usually configured to v1.35 V was
      reported as 1.2 V).
      
      On most of the boards these regulators are left in default state so this
      was only affecting reported voltage.  However if any driver wanted to
      change them, then effectively it would set voltage 150 mV higher than
      intended.
      
      Cc: <stable@vger.kernel.org>
      Fixes: cb74685e ("regulator: s2mps11: Add samsung s2mps11 regulator driver")
      Signed-off-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      042451b9
    • H
      Input: alps - fix a mismatch between a condition check and its comment · 8da63aa4
      Hui Wang 提交于
      commit 771a081e44a9baa1991ef011cc453ef425591740 upstream.
      
      In the function alps_is_cs19_trackpoint(), we check if the param[1] is
      in the 0x20~0x2f range, but the code we wrote for this checking is not
      correct:
      (param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f,
      it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f...
      
      Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20).
      
      Fixes: 7e4935ccc323 ("Input: alps - don't handle ALPS cs19 trackpoint-only device")
      Cc: stable@vger.kernel.org
      Signed-off-by: NHui Wang <hui.wang@canonical.com>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8da63aa4
    • N
      Input: synaptics - whitelist Lenovo T580 SMBus intertouch · 81368a9a
      Nick Black 提交于
      commit 1976d7d200c5a32e72293a2ada36b7b7c9d6dd6e upstream.
      
      Adds the Lenovo T580 to the SMBus intertouch list for Synaptics
      touchpads. I've tested with this for a week now, and it seems a great
      improvement. It's also nice to have the complaint gone from dmesg.
      Signed-off-by: NNick Black <dankamongmen@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81368a9a
    • H
      Input: alps - don't handle ALPS cs19 trackpoint-only device · cfb92506
      Hui Wang 提交于
      commit 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 upstream.
      
      On a latest Lenovo laptop, the trackpoint and 3 buttons below it
      don't work at all, when we move the trackpoint or press those 3
      buttons, the kernel will print out:
      "Rejected trackstick packet from non DualPoint device"
      
      This device is identified as an alps touchpad but the packet has
      trackpoint format, so the alps.c drops the packet and prints out
      the message above.
      
      According to XiaoXiao's explanation, this device is named cs19 and
      is trackpoint-only device, its firmware is only for trackpoint, it
      is independent of touchpad and is a device completely different from
      DualPoint ones.
      
      To drive this device with mininal changes to the existing driver, we
      just let the alps driver not handle this device, then the trackpoint.c
      will be the driver of this device if the trackpoint driver is enabled.
      (if not, this device will fallback to a bare PS/2 device)
      
      With the trackpoint.c, this trackpoint and 3 buttons all work well,
      they have all features that the trackpoint should have, like
      scrolling-screen, drag-and-drop and frame-selection.
      Signed-off-by: NXiaoXiao Liu <sliuuxiaonxiao@gmail.com>
      Signed-off-by: NHui Wang <hui.wang@canonical.com>
      Reviewed-by: NPali Rohár <pali.rohar@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cfb92506
    • G
      Input: gtco - bounds check collection indent level · d657077e
      Grant Hernandez 提交于
      commit 2a017fd82c5402b3c8df5e3d6e5165d9e6147dc1 upstream.
      
      The GTCO tablet input driver configures itself from an HID report sent
      via USB during the initial enumeration process. Some debugging messages
      are generated during the parsing. A debugging message indentation
      counter is not bounds checked, leading to the ability for a specially
      crafted HID report to cause '-' and null bytes be written past the end
      of the indentation array. As long as the kernel has CONFIG_DYNAMIC_DEBUG
      enabled, this code will not be optimized out.  This was discovered
      during code review after a previous syzkaller bug was found in this
      driver.
      Signed-off-by: NGrant Hernandez <granthernandez@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d657077e
    • C
      bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread · f11ba9df
      Coly Li 提交于
      commit f54d801dda14942dbefa00541d10603015b7859c upstream.
      
      Commit 9baf3097 ("bcache: fix for gc and write-back race") added a
      new work queue dc->writeback_write_wq, but forgot to destroy it in the
      error condition when creating dc->writeback_thread failed.
      
      This patch destroys dc->writeback_write_wq if kthread_create() returns
      error pointer to dc->writeback_thread, then a memory leak is avoided.
      
      Fixes: 9baf3097 ("bcache: fix for gc and write-back race")
      Signed-off-by: NColy Li <colyli@suse.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f11ba9df
    • C
      bcache: fix mistaken sysfs entry for io_error counter · 2ab14861
      Coly Li 提交于
      commit 5461999848e0462c14f306a62923d22de820a59c upstream.
      
      In bch_cached_dev_files[] from driver/md/bcache/sysfs.c, sysfs_errors is
      incorrectly inserted in. The correct entry should be sysfs_io_errors.
      
      This patch fixes the problem and now I/O errors of cached device can be
      read from /sys/block/bcache<N>/bcache/io_errors.
      
      Fixes: c7b7bd07 ("bcache: add io_disable to struct cached_dev")
      Signed-off-by: NColy Li <colyli@suse.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2ab14861