1. 27 May, 2020 24 commits
    • Daniel Jordan's avatar
      padata: purge get_cpu and reorder_via_wq from padata_do_serial · bae3b507
      Daniel Jordan authored
      [ Upstream commit 065cf577 ]
      
      With the removal of the padata timer, padata_do_serial no longer
      needs special CPU handling, so remove it.
      Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bae3b507
    • Daniel Jordan's avatar
      padata: initialize pd->cpu with effective cpumask · 52a3af1c
      Daniel Jordan authored
      [ Upstream commit ec9c7d19 ]
      
      Exercising CPU hotplug on a 5.2 kernel with recent padata fixes from
      cryptodev-2.6.git in an 8-CPU kvm guest...
      
          # modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
          # echo 0 > /sys/devices/system/cpu/cpu1/online
          # echo c > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
          # modprobe tcrypt mode=215
      
      ...caused the following crash:
      
          BUG: kernel NULL pointer dereference, address: 0000000000000000
          #PF: supervisor read access in kernel mode
          #PF: error_code(0x0000) - not-present page
          PGD 0 P4D 0
          Oops: 0000 [#1] SMP PTI
          CPU: 2 PID: 134 Comm: kworker/2:2 Not tainted 5.2.0-padata-base+ #7
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-<snip>
          Workqueue: pencrypt padata_parallel_worker
          RIP: 0010:padata_reorder+0xcb/0x180
          ...
          Call Trace:
           padata_do_serial+0x57/0x60
           pcrypt_aead_enc+0x3a/0x50 [pcrypt]
           padata_parallel_worker+0x9b/0xe0
           process_one_work+0x1b5/0x3f0
           worker_thread+0x4a/0x3c0
           ...
      
      In padata_alloc_pd, pd->cpu is set using the user-supplied cpumask
      instead of the effective cpumask, and in this case cpumask_first picked
      an offline CPU.
      
      The offline CPU's reorder->list.next is NULL in padata_reorder because
      the list wasn't initialized in padata_init_pqueues, which only operates
      on CPUs in the effective mask.
      
      Fix by using the effective mask in padata_alloc_pd.
      
      Fixes: 6fc4dbcf ("padata: Replace delayed timer with immediate workqueue in padata_reorder")
      Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      52a3af1c
    • Herbert Xu's avatar
      padata: Replace delayed timer with immediate workqueue in padata_reorder · f501513b
      Herbert Xu authored
      [ Upstream commit 6fc4dbcf ]
      
      The function padata_reorder will use a timer when it cannot progress
      while completed jobs are outstanding (pd->reorder_objects > 0).  This
      is suboptimal as if we do end up using the timer then it would have
      introduced a gratuitous delay of one second.
      
      In fact we can easily distinguish between whether completed jobs
      are outstanding and whether we can make progress.  All we have to
      do is look at the next pqueue list.
      
      This patch does that by replacing pd->processed with pd->cpu so
      that the next pqueue is more accessible.
      
      A work queue is used instead of the original try_again to avoid
      hogging the CPU.
      
      Note that we don't bother removing the work queue in
      padata_flush_queues because the whole premise is broken.  You
      cannot flush async crypto requests so it makes no sense to even
      try.  A subsequent patch will fix it by replacing it with a ref
      counting scheme.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      [dj: - adjust context
           - corrected setup_timer -> timer_setup to delete hunk
           - skip padata_flush_queues() hunk, function already removed
             in 4.9]
      Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f501513b
    • Mathias Krause's avatar
      padata: set cpu_index of unused CPUs to -1 · 251716d9
      Mathias Krause authored
      [ Upstream commit 1bd845bc ]
      
      The parallel queue per-cpu data structure gets initialized only for CPUs
      in the 'pcpu' CPU mask set. This is not sufficient as the reorder timer
      may run on a different CPU and might wrongly decide it's the target CPU
      for the next reorder item as per-cpu memory gets memset(0) and we might
      be waiting for the first CPU in cpumask.pcpu, i.e. cpu_index 0.
      
      Make the '__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index'
      compare in padata_get_next() fail in this case by initializing the
      cpu_index member of all per-cpu parallel queues. Use -1 for unused ones.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      251716d9
    • Kevin Hao's avatar
      i2c: dev: Fix the race between the release of i2c_dev and cdev · c0d34399
      Kevin Hao authored
      [ Upstream commit 1413ef63 ]
      
      The struct cdev is embedded in the struct i2c_dev. In the current code,
      we would free the i2c_dev struct directly in put_i2c_dev(), but the
      cdev is manged by a kobject, and the release of it is not predictable.
      So it is very possible that the i2c_dev is freed before the cdev is
      entirely released. We can easily get the following call trace with
      CONFIG_DEBUG_KOBJECT_RELEASE and CONFIG_DEBUG_OBJECTS_TIMERS enabled.
        ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x38
        WARNING: CPU: 19 PID: 1 at lib/debugobjects.c:325 debug_print_object+0xb0/0xf0
        Modules linked in:
        CPU: 19 PID: 1 Comm: swapper/0 Tainted: G        W         5.2.20-yocto-standard+ #120
        Hardware name: Marvell OcteonTX CN96XX board (DT)
        pstate: 80c00089 (Nzcv daIf +PAN +UAO)
        pc : debug_print_object+0xb0/0xf0
        lr : debug_print_object+0xb0/0xf0
        sp : ffff00001292f7d0
        x29: ffff00001292f7d0 x28: ffff800b82151788
        x27: 0000000000000001 x26: ffff800b892c0000
        x25: ffff0000124a2558 x24: 0000000000000000
        x23: ffff00001107a1d8 x22: ffff0000116b5088
        x21: ffff800bdc6afca8 x20: ffff000012471ae8
        x19: ffff00001168f2c8 x18: 0000000000000010
        x17: 00000000fd6f304b x16: 00000000ee79de43
        x15: ffff800bc0e80568 x14: 79616c6564203a74
        x13: 6e6968207473696c x12: 5f72656d6974203a
        x11: ffff0000113f0018 x10: 0000000000000000
        x9 : 000000000000001f x8 : 0000000000000000
        x7 : ffff0000101294cc x6 : 0000000000000000
        x5 : 0000000000000000 x4 : 0000000000000001
        x3 : 00000000ffffffff x2 : 0000000000000000
        x1 : 387fc15c8ec0f200 x0 : 0000000000000000
        Call trace:
         debug_print_object+0xb0/0xf0
         __debug_check_no_obj_freed+0x19c/0x228
         debug_check_no_obj_freed+0x1c/0x28
         kfree+0x250/0x440
         put_i2c_dev+0x68/0x78
         i2cdev_detach_adapter+0x60/0xc8
         i2cdev_notifier_call+0x3c/0x70
         notifier_call_chain+0x8c/0xe8
         blocking_notifier_call_chain+0x64/0x88
         device_del+0x74/0x380
         device_unregister+0x54/0x78
         i2c_del_adapter+0x278/0x2d0
         unittest_i2c_bus_remove+0x3c/0x80
         platform_drv_remove+0x30/0x50
         device_release_driver_internal+0xf4/0x1c0
         driver_detach+0x58/0xa0
         bus_remove_driver+0x84/0xd8
         driver_unregister+0x34/0x60
         platform_driver_unregister+0x20/0x30
         of_unittest_overlay+0x8d4/0xbe0
         of_unittest+0xae8/0xb3c
         do_one_initcall+0xac/0x450
         do_initcall_level+0x208/0x224
         kernel_init_freeable+0x2d8/0x36c
         kernel_init+0x18/0x108
         ret_from_fork+0x10/0x1c
        irq event stamp: 3934661
        hardirqs last  enabled at (3934661): [<ffff00001009fa04>] debug_exception_exit+0x4c/0x58
        hardirqs last disabled at (3934660): [<ffff00001009fb14>] debug_exception_enter+0xa4/0xe0
        softirqs last  enabled at (3934654): [<ffff000010081d94>] __do_softirq+0x46c/0x628
        softirqs last disabled at (3934649): [<ffff0000100b4a1c>] irq_exit+0x104/0x118
      
      This is a common issue when using cdev embedded in a struct.
      Fortunately, we already have a mechanism to solve this kind of issue.
      Please see commit 233ed09d ("chardev: add helper function to
      register char devs with a struct device") for more detail.
      
      In this patch, we choose to embed the struct device into the i2c_dev,
      and use the API provided by the commit 233ed09d to make sure that
      the release of i2c_dev and cdev are in sequence.
      Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0d34399
    • Thomas Gleixner's avatar
      ARM: futex: Address build warning · 7a5c2b73
      Thomas Gleixner authored
      [ Upstream commit 8101b5a1 ]
      
      Stephen reported the following build warning on a ARM multi_v7_defconfig
      build with GCC 9.2.1:
      
      kernel/futex.c: In function 'do_futex':
      kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
       1676 |   return oldval == cmparg;
            |          ~~~~~~~^~~~~~~~~
      kernel/futex.c:1652:6: note: 'oldval' was declared here
       1652 |  int oldval, ret;
            |      ^~~~~~
      
      introduced by commit a08971e9 ("futex: arch_futex_atomic_op_inuser()
      calling conventions change").
      
      While that change should not make any difference it confuses GCC which
      fails to work out that oldval is not referenced when the return value is
      not zero.
      
      GCC fails to properly analyze arch_futex_atomic_op_inuser(). It's not the
      early return, the issue is with the assembly macros. GCC fails to detect
      that those either set 'ret' to 0 and set oldval or set 'ret' to -EFAULT
      which makes oldval uninteresting. The store to the callsite supplied oldval
      pointer is conditional on ret == 0.
      
      The straight forward way to solve this is to make the store unconditional.
      
      Aside of addressing the build warning this makes sense anyway because it
      removes the conditional from the fastpath. In the error case the stored
      value is uninteresting and the extra store does not matter at all.
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/87pncao2ph.fsf@nanos.tec.linutronix.deSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      7a5c2b73
    • Hans de Goede's avatar
      platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA · e09cb4c3
      Hans de Goede authored
      [ Upstream commit 3bd12da7 ]
      
      asus-nb-wmi does not add any extra functionality on these Asus
      Transformer books. They have detachable keyboards, so the hotkeys are
      send through a HID device (and handled by the hid-asus driver) and also
      the rfkill functionality is not used on these devices.
      
      Besides not adding any extra functionality, initializing the WMI interface
      on these devices actually has a negative side-effect. For some reason
      the \_SB.ATKD.INIT() function which asus_wmi_platform_init() calls drives
      GPO2 (INT33FC:02) pin 8, which is connected to the front facing webcam LED,
      high and there is no (WMI or other) interface to drive this low again
      causing the LED to be permanently on, even during suspend.
      
      This commit adds a blacklist of DMI system_ids on which not to load the
      asus-nb-wmi and adds these Transformer books to this list. This fixes
      the webcam LED being permanently on under Linux.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e09cb4c3
    • Alan Stern's avatar
      USB: core: Fix misleading driver bug report · 21851aa8
      Alan Stern authored
      [ Upstream commit ac854131 ]
      
      The syzbot fuzzer found a race between URB submission to endpoint 0
      and device reset.  Namely, during the reset we call usb_ep0_reinit()
      because the characteristics of ep0 may have changed (if the reset
      follows a firmware update, for example).  While usb_ep0_reinit() is
      running there is a brief period during which the pointers stored in
      udev->ep_in[0] and udev->ep_out[0] are set to NULL, and if an URB is
      submitted to ep0 during that period, usb_urb_ep_type_check() will
      report it as a driver bug.  In the absence of those pointers, the
      routine thinks that the endpoint doesn't exist.  The log message looks
      like this:
      
      ------------[ cut here ]------------
      usb 2-1: BOGUS urb xfer, pipe 2 != type 2
      WARNING: CPU: 0 PID: 9241 at drivers/usb/core/urb.c:478
      usb_submit_urb+0x1188/0x1460 drivers/usb/core/urb.c:478
      
      Now, although submitting an URB while the device is being reset is a
      questionable thing to do, it shouldn't count as a driver bug as severe
      as submitting an URB for an endpoint that doesn't exist.  Indeed,
      endpoint 0 always exists, even while the device is in its unconfigured
      state.
      
      To prevent these misleading driver bug reports, this patch updates
      usb_disable_endpoint() to avoid clearing the ep_in[] and ep_out[]
      pointers when the endpoint being disabled is ep0.  There's no danger
      of leaving a stale pointer in place, because the usb_host_endpoint
      structure being pointed to is stored permanently in udev->ep0; it
      doesn't get deallocated until the entire usb_device structure does.
      
      Reported-and-tested-by: syzbot+db339689b2101f6f6071@syzkaller.appspotmail.com
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2005011558590.903-100000@netrider.rowland.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      21851aa8
    • Wu Bo's avatar
      ceph: fix double unlock in handle_cap_export() · 1de356b1
      Wu Bo authored
      [ Upstream commit 4d8e28ff ]
      
      If the ceph_mdsc_open_export_target_session() return fails, it will
      do a "goto retry", but the session mutex has already been unlocked.
      Re-lock the mutex in that case to ensure that we don't unlock it
      twice.
      Signed-off-by: default avatarWu Bo <wubo40@huawei.com>
      Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1de356b1
    • Yoshiyuki Kurauchi's avatar
      gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp() · 2e7f7b28
      Yoshiyuki Kurauchi authored
      [ Upstream commit 846c68f7 ]
      
      In drivers/net/gtp.c, gtp_genl_dump_pdp() should set NLM_F_MULTI
      flag since it returns multipart message.
      This patch adds a new arg "flags" in gtp_genl_fill_info() so that
      flags can be set by the callers.
      Signed-off-by: default avatarYoshiyuki Kurauchi <ahochauwaaaaa@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2e7f7b28
    • James Hilliard's avatar
      component: Silence bind error on -EPROBE_DEFER · 2700d2c2
      James Hilliard authored
      [ Upstream commit 7706b0a7 ]
      
      If a component fails to bind due to -EPROBE_DEFER we should not log an
      error as this is not a real failure.
      
      Fixes messages like:
      vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517
      vc4-drm soc:gpu: master bind failed: -517
      Signed-off-by: default avatarJames Hilliard <james.hilliard1@gmail.com>
      Link: https://lore.kernel.org/r/20200411190241.89404-1-james.hilliard1@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2700d2c2
    • Xiyu Yang's avatar
      configfs: fix config_item refcnt leak in configfs_rmdir() · 1957df49
      Xiyu Yang authored
      [ Upstream commit 8aebfffa ]
      
      configfs_rmdir() invokes configfs_get_config_item(), which returns a
      reference of the specified config_item object to "parent_item" with
      increased refcnt.
      
      When configfs_rmdir() returns, local variable "parent_item" becomes
      invalid, so the refcount should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one exception handling path of
      configfs_rmdir(). When down_write_killable() fails, the function forgets
      to decrease the refcnt increased by configfs_get_config_item(), causing
      a refcnt leak.
      
      Fix this issue by calling config_item_put() when down_write_killable()
      fails.
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1957df49
    • Sebastian Reichel's avatar
      HID: multitouch: add eGalaxTouch P80H84 support · f477b49c
      Sebastian Reichel authored
      [ Upstream commit f9e82295 ]
      
      Add support for P80H84 touchscreen from eGalaxy:
      
        idVendor           0x0eef D-WAV Scientific Co., Ltd
        idProduct          0xc002
        iManufacturer           1 eGalax Inc.
        iProduct                2 eGalaxTouch P80H84 2019 vDIVA_1204_T01 k4.02.146
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f477b49c
    • Frédéric Pierret (fepitre)'s avatar
      gcc-common.h: Update for GCC 10 · ebf9988e
      Frédéric Pierret (fepitre) authored
      [ Upstream commit c7527373 ]
      
      Remove "params.h" include, which has been dropped in GCC 10.
      
      Remove is_a_helper() macro, which is now defined in gimple.h, as seen
      when running './scripts/gcc-plugin.sh g++ g++ gcc':
      
      In file included from <stdin>:1:
      ./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’
        852 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
            |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from ./gcc-plugins/gcc-common.h:125,
                       from <stdin>:1:
      /usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
       1037 | is_a_helper <const ggoto *>::test (const gimple *gs)
            | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Add -Wno-format-diag to scripts/gcc-plugins/Makefile to avoid
      meaningless warnings from error() formats used by plugins:
      
      scripts/gcc-plugins/structleak_plugin.c: In function ‘int plugin_init(plugin_name_args*, plugin_gcc_version*)’:
      scripts/gcc-plugins/structleak_plugin.c:253:12: warning: unquoted sequence of 2 consecutive punctuation characters ‘'-’ in format [-Wformat-diag]
        253 |   error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarFrédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
      Link: https://lore.kernel.org/r/20200407113259.270172-1-frederic.pierret@qubes-os.org
      [kees: include -Wno-format-diag for plugin builds]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ebf9988e
    • Christophe JAILLET's avatar
      i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()' · 350d523b
      Christophe JAILLET authored
      [ Upstream commit e9d1a0a4 ]
      
      A call to 'i2c_demux_deactivate_master()' is missing in the error handling
      path, as already done in the remove function.
      
      Fixes: 50a5ba87 ("i2c: mux: demux-pinctrl: add driver")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      350d523b
    • Alexander Monakov's avatar
      iommu/amd: Fix over-read of ACPI UID from IVRS table · 57dd229d
      Alexander Monakov authored
      [ Upstream commit e461b8c9 ]
      
      IVRS parsing code always tries to read 255 bytes from memory when
      retrieving ACPI device path, and makes an assumption that firmware
      provides a zero-terminated string. Both of those are bugs: the entry
      is likely to be shorter than 255 bytes, and zero-termination is not
      guaranteed.
      
      With Acer SF314-42 firmware these issues manifest visibly in dmesg:
      
      AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR0\xf0\xa5, rdevid:160
      AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR1\xf0\xa5, rdevid:160
      AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR2\xf0\xa5, rdevid:160
      AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR3>\x83e\x8d\x9a\xd1...
      
      The first three lines show how the code over-reads adjacent table
      entries into the UID, and in the last line it even reads garbage data
      beyond the end of the IVRS table itself.
      
      Since each entry has the length of the UID (uidl member of ivhd_entry
      struct), use that for memcpy, and manually add a zero terminator.
      
      Avoid zero-filling hid and uid arrays up front, and instead ensure
      the uid array is always zero-terminated. No change needed for the hid
      array, as it was already properly zero-terminated.
      
      Fixes: 2a0cb4e2 ("iommu/amd: Add new map for storing IVHD dev entry type HID")
      Signed-off-by: default avatarAlexander Monakov <amonakov@ispras.ru>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: iommu@lists.linux-foundation.org
      Link: https://lore.kernel.org/r/20200511102352.1831-1-amonakov@ispras.ruSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      57dd229d
    • Al Viro's avatar
      fix multiplication overflow in copy_fdtable() · 26204c47
      Al Viro authored
      [ Upstream commit 4e89b721 ]
      
      cpy and set really should be size_t; we won't get an overflow on that,
      since sysctl_nr_open can't be set above ~(size_t)0 / sizeof(void *),
      so nr that would've managed to overflow size_t on that multiplication
      won't get anywhere near copy_fdtable() - we'll fail with EMFILE
      before that.
      
      Cc: stable@kernel.org # v2.6.25+
      Fixes: 9cfe015a (get rid of NR_OPEN and introduce a sysctl_nr_open)
      Reported-by: default avatarThiago Macieira <thiago.macieira@intel.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      26204c47
    • Roberto Sassu's avatar
      ima: Fix return value of ima_write_policy() · d8d4da8a
      Roberto Sassu authored
      [ Upstream commit 2e3a34e9 ]
      
      This patch fixes the return value of ima_write_policy() when a new policy
      is directly passed to IMA and the current policy requires appraisal of the
      file containing the policy. Currently, if appraisal is not in ENFORCE mode,
      ima_write_policy() returns 0 and leads user space applications to an
      endless loop. Fix this issue by denying the operation regardless of the
      appraisal mode.
      
      Cc: stable@vger.kernel.org # 4.10.x
      Fixes: 19f8a847 ("ima: measure and appraise the IMA policy itself")
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarKrzysztof Struczynski <krzysztof.struczynski@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d8d4da8a
    • Roberto Sassu's avatar
      evm: Check also if *tfm is an error pointer in init_desc() · ab97e5a9
      Roberto Sassu authored
      [ Upstream commit 53de3b08 ]
      
      This patch avoids a kernel panic due to accessing an error pointer set by
      crypto_alloc_shash(). It occurs especially when there are many files that
      require an unsupported algorithm, as it would increase the likelihood of
      the following race condition:
      
      Task A: *tfm = crypto_alloc_shash() <= error pointer
      Task B: if (*tfm == NULL) <= *tfm is not NULL, use it
      Task B: rc = crypto_shash_init(desc) <= panic
      Task A: *tfm = NULL
      
      This patch uses the IS_ERR_OR_NULL macro to determine whether or not a new
      crypto context must be created.
      
      Cc: stable@vger.kernel.org
      Fixes: d46eb369 ("evm: crypto hash replaced by shash")
      Co-developed-by: default avatarKrzysztof Struczynski <krzysztof.struczynski@huawei.com>
      Signed-off-by: default avatarKrzysztof Struczynski <krzysztof.struczynski@huawei.com>
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ab97e5a9
    • Mathias Krause's avatar
      padata: ensure padata_do_serial() runs on the correct CPU · 6953f88c
      Mathias Krause authored
      commit 350ef88e upstream.
      
      If the algorithm we're parallelizing is asynchronous we might change
      CPUs between padata_do_parallel() and padata_do_serial(). However, we
      don't expect this to happen as we need to enqueue the padata object into
      the per-cpu reorder queue we took it from, i.e. the same-cpu's parallel
      queue.
      
      Ensure we're not switching CPUs for a given padata object by tracking
      the CPU within the padata object. If the serial callback gets called on
      the wrong CPU, defer invoking padata_reorder() via a kernel worker on
      the CPU we're expected to run on.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6953f88c
    • Mathias Krause's avatar
      padata: ensure the reorder timer callback runs on the correct CPU · 08257da7
      Mathias Krause authored
      commit cf5868c8 upstream.
      
      The reorder timer function runs on the CPU where the timer interrupt was
      handled which is not necessarily one of the CPUs of the 'pcpu' CPU mask
      set.
      
      Ensure the padata_reorder() callback runs on the correct CPU, which is
      one in the 'pcpu' CPU mask set and, preferrably, the next expected one.
      Do so by comparing the current CPU with the expected target CPU. If they
      match, call padata_reorder() right away. If they differ, schedule a work
      item on the target CPU that does the padata_reorder() call for us.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08257da7
    • Jason A. Donenfeld's avatar
      padata: get_next is never NULL · 7174609f
      Jason A. Donenfeld authored
      commit 69b34844 upstream.
      
      Per Dan's static checker warning, the code that returns NULL was removed
      in 2010, so this patch updates the comments and fixes the code
      assumptions.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7174609f
    • Tobias Klauser's avatar
      padata: Remove unused but set variables · c4c5322a
      Tobias Klauser authored
      commit 119a0798 upstream.
      
      Remove the unused but set variable pinst in padata_parallel_worker to
      fix the following warning when building with 'W=1':
      
        kernel/padata.c: In function ‘padata_parallel_worker’:
        kernel/padata.c:68:26: warning: variable ‘pinst’ set but not used [-Wunused-but-set-variable]
      
      Also remove the now unused variable pd which is only used to set pinst.
      Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Acked-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c4c5322a
    • Cao jin's avatar
      igb: use igb_adapter->io_addr instead of e1000_hw->hw_addr · 0b3bc1fb
      Cao jin authored
      commit 629823b8 upstream.
      
      When running as guest, under certain condition, it will oops as following.
      writel() in igb_configure_tx_ring() results in oops, because hw->hw_addr
      is NULL. While other register access won't oops kernel because they use
      wr32/rd32 which have a defense against NULL pointer.
      
          [  141.225449] pcieport 0000:00:1c.0: AER: Multiple Uncorrected (Fatal)
          error received: id=0101
          [  141.225523] igb 0000:01:00.1: PCIe Bus Error:
          severity=Uncorrected (Fatal), type=Unaccessible,
          id=0101(Unregistered Agent ID)
          [  141.299442] igb 0000:01:00.1: broadcast error_detected message
          [  141.300539] igb 0000:01:00.0 enp1s0f0: PCIe link lost, device now
          detached
          [  141.351019] igb 0000:01:00.1 enp1s0f1: PCIe link lost, device now
          detached
          [  143.465904] pcieport 0000:00:1c.0: Root Port link has been reset
          [  143.465994] igb 0000:01:00.1: broadcast slot_reset message
          [  143.466039] igb 0000:01:00.0: enabling device (0000 -> 0002)
          [  144.389078] igb 0000:01:00.1: enabling device (0000 -> 0002)
          [  145.312078] igb 0000:01:00.1: broadcast resume message
          [  145.322211] BUG: unable to handle kernel paging request at
          0000000000003818
          [  145.361275] IP: [<ffffffffa02fd38d>]
          igb_configure_tx_ring+0x14d/0x280 [igb]
          [  145.400048] PGD 0
          [  145.438007] Oops: 0002 [#1] SMP
      
      A similar issue & solution could be found at:
          http://patchwork.ozlabs.org/patch/689592/Signed-off-by: default avatarCao jin <caoj.fnst@cn.fujitsu.com>
      Acked-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b3bc1fb
  2. 20 May, 2020 16 commits