1. 27 May, 2020 18 commits
    • James Hilliard's avatar
      component: Silence bind error on -EPROBE_DEFER · 3c4bffd4
      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.com
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c4bffd4
    • Stefano Garzarella's avatar
      vhost/vsock: fix packet delivery order to monitoring devices · 486a2450
      Stefano Garzarella authored
      [ Upstream commit 107bc076
      
       ]
      
      We want to deliver packets to monitoring devices before it is
      put in the virtqueue, to avoid that replies can appear in the
      packet capture before the transmitted packet.
      Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      486a2450
    • Xiyu Yang's avatar
      configfs: fix config_item refcnt leak in configfs_rmdir() · 5765f42d
      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>
      5765f42d
    • Arun Easi's avatar
      scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV · 18859aa4
      Arun Easi authored
      [ Upstream commit 45a76264 ]
      
      In NPIV environment, a NPIV host may use a queue pair created by base host
      or other NPIVs, so the check for a queue pair created by this NPIV is not
      correct, and can cause an abort to fail, which in turn means the NVME
      command not returned.  This leads to hang in nvme_fc layer in
      nvme_fc_delete_association() which waits for all I/Os to be returned, which
      is seen as hang in the application.
      
      Link: https://lore.kernel.org/r/20200331104015.24868-3-njavali@marvell.com
      
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarArun Easi <aeasi@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18859aa4
    • Sebastian Reichel's avatar
      HID: multitouch: add eGalaxTouch P80H84 support · 6a42492d
      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>
      6a42492d
    • Frédéric Pierret (fepitre)'s avatar
      gcc-common.h: Update for GCC 10 · a5ef8f46
      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>
      a5ef8f46
    • Richard Weinberger's avatar
      ubi: Fix seq_file usage in detailed_erase_block_info debugfs file · d840a584
      Richard Weinberger authored
      [ Upstream commit 0e7572cf ]
      
      3bfa7e14 ("fs/seq_file.c: seq_read(): add info message about buggy .next functions")
      showed that we don't use seq_file correctly.
      So make sure that our ->next function always updates the position.
      
      Fixes: 7bccd12d
      
       ("ubi: Add debugfs file for tracking PEB state")
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d840a584
    • Christophe JAILLET's avatar
      i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()' · af50d1a9
      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>
      af50d1a9
    • Alexander Monakov's avatar
      iommu/amd: Fix over-read of ACPI UID from IVRS table · 491ab270
      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.ru
      
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      491ab270
    • Al Viro's avatar
      fix multiplication overflow in copy_fdtable() · 2a738364
      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>
      2a738364
    • Roberto Sassu's avatar
      ima: Fix return value of ima_write_policy() · fa63cb9b
      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>
      fa63cb9b
    • Roberto Sassu's avatar
      evm: Check also if *tfm is an error pointer in init_desc() · 9bf11248
      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>
      9bf11248
    • Roberto Sassu's avatar
      ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash() · 7bc13800
      Roberto Sassu authored
      [ Upstream commit 0014cc04 ]
      
      Commit a408e4a8 ("ima: open a new file instance if no read
      permissions") tries to create a new file descriptor to calculate a file
      digest if the file has not been opened with O_RDONLY flag. However, if a
      new file descriptor cannot be obtained, it sets the FMODE_READ flag to
      file->f_flags instead of file->f_mode.
      
      This patch fixes this issue by replacing f_flags with f_mode as it was
      before that commit.
      
      Cc: stable@vger.kernel.org # 4.20.x
      Fixes: a408e4a8
      
       ("ima: open a new file instance if no read permissions")
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7bc13800
    • Mathias Krause's avatar
      padata: ensure padata_do_serial() runs on the correct CPU · 0a9ac7ce
      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>
      0a9ac7ce
    • Mathias Krause's avatar
      padata: ensure the reorder timer callback runs on the correct CPU · a68ca9a2
      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>
      a68ca9a2
    • Kevin Hao's avatar
      i2c: dev: Fix the race between the release of i2c_dev and cdev · f1f3b415
      Kevin Hao authored
      commit 1413ef63 upstream.
      
      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>
      Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1f3b415
    • Kevin Hao's avatar
      watchdog: Fix the race between the release of watchdog_core_data and cdev · 450caf1f
      Kevin Hao authored
      commit 72139dfa upstream.
      
      The struct cdev is embedded in the struct watchdog_core_data. In the
      current code, we manage the watchdog_core_data with a kref, but the
      cdev is manged by a kobject. There is no any relationship between
      this kref and kobject. So it is possible that the watchdog_core_data 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: 23 PID: 1028 at lib/debugobjects.c:481 debug_print_object+0xb0/0xf0
        Modules linked in: softdog(-) deflate ctr twofish_generic twofish_common camellia_generic serpent_generic blowfish_generic blowfish_common cast5_generic cast_common cmac xcbc af_key sch_fq_codel openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4
        CPU: 23 PID: 1028 Comm: modprobe Not tainted 5.3.0-next-20190924-yoctodev-standard+ #180
        Hardware name: Marvell OcteonTX CN96XX board (DT)
        pstate: 00400009 (nzcv daif +PAN -UAO)
        pc : debug_print_object+0xb0/0xf0
        lr : debug_print_object+0xb0/0xf0
        sp : ffff80001cbcfc70
        x29: ffff80001cbcfc70 x28: ffff800010ea2128
        x27: ffff800010bad000 x26: 0000000000000000
        x25: ffff80001103c640 x24: ffff80001107b268
        x23: ffff800010bad9e8 x22: ffff800010ea2128
        x21: ffff000bc2c62af8 x20: ffff80001103c600
        x19: ffff800010e867d8 x18: 0000000000000060
        x17: 0000000000000000 x16: 0000000000000000
        x15: ffff000bd7240470 x14: 6e6968207473696c
        x13: 5f72656d6974203a x12: 6570797420746365
        x11: 6a626f2029302065 x10: 7461747320657669
        x9 : 7463612820657669 x8 : 3378302f3078302b
        x7 : 0000000000001d7a x6 : ffff800010fd5889
        x5 : 0000000000000000 x4 : 0000000000000000
        x3 : 0000000000000000 x2 : ffff000bff948548
        x1 : 276a1c9e1edc2300 x0 : 0000000000000000
        Call trace:
         debug_print_object+0xb0/0xf0
         debug_check_no_obj_freed+0x1e8/0x210
         kfree+0x1b8/0x368
         watchdog_cdev_unregister+0x88/0xc8
         watchdog_dev_unregister+0x38/0x48
         watchdog_unregister_device+0xa8/0x100
         softdog_exit+0x18/0xfec4 [softdog]
         __arm64_sys_delete_module+0x174/0x200
         el0_svc_handler+0xd0/0x1c8
         el0_svc+0x8/0xc
      
      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
      watchdog_core_data, and use the API provided by the commit 233ed09d
      
      
      to make sure that the release of watchdog_core_data and cdev are
      in sequence.
      Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20191008112934.29669-1-haokexin@gmail.com
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
      [bwh: Backported to 4.14:
       - There's no reboot notifier here
       - Adjust context]
      Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      450caf1f
    • Shijie Luo's avatar
      ext4: add cond_resched() to ext4_protect_reserved_inode · 9dfc877a
      Shijie Luo authored
      commit af133ade upstream.
      
      When journal size is set too big by "mkfs.ext4 -J size=", or when
      we mount a crafted image to make journal inode->i_size too big,
      the loop, "while (i < num)", holds cpu too long. This could cause
      soft lockup.
      
      [  529.357541] Call trace:
      [  529.357551]  dump_backtrace+0x0/0x198
      [  529.357555]  show_stack+0x24/0x30
      [  529.357562]  dump_stack+0xa4/0xcc
      [  529.357568]  watchdog_timer_fn+0x300/0x3e8
      [  529.357574]  __hrtimer_run_queues+0x114/0x358
      [  529.357576]  hrtimer_interrupt+0x104/0x2d8
      [  529.357580]  arch_timer_handler_virt+0x38/0x58
      [  529.357584]  handle_percpu_devid_irq+0x90/0x248
      [  529.357588]  generic_handle_irq+0x34/0x50
      [  529.357590]  __handle_domain_irq+0x68/0xc0
      [  529.357593]  gic_handle_irq+0x6c/0x150
      [  529.357595]  el1_irq+0xb8/0x140
      [  529.357599]  __ll_sc_atomic_add_return_acquire+0x14/0x20
      [  529.357668]  ext4_map_blocks+0x64/0x5c0 [ext4]
      [  529.357693]  ext4_setup_system_zone+0x330/0x458 [ext4]
      [  529.357717]  ext4_fill_super+0x2170/0x2ba8 [ext4]
      [  529.357722]  mount_bdev+0x1a8/0x1e8
      [  529.357746]  ext4_mount+0x44/0x58 [ext4]
      [  529.357748]  mount_fs+0x50/0x170
      [  529.357752]  vfs_kern_mount.part.9+0x54/0x188
      [  529.357755]  do_mount+0x5ac/0xd78
      [  529.357758]  ksys_mount+0x9c/0x118
      [  529.357760]  __arm64_sys_mount+0x28/0x38
      [  529.357764]  el0_svc_common+0x78/0x130
      [  529.357766]  el0_svc_handler+0x38/0x78
      [  529.357769]  el0_svc+0x8/0xc
      [  541.356516] watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [mount:18674]
      
      Link: https://lore.kernel.org/r/20200211011752.29242-1-luoshijie1@huawei.com
      
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarShijie Luo <luoshijie1@huawei.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9dfc877a
  2. 20 May, 2020 22 commits