1. 12 10月, 2019 35 次提交
    • X
      nbd: fix crash when the blksize is zero · c688982f
      Xiubo Li 提交于
      [ Upstream commit 553768d1169a48c0cd87c4eb4ab57534ee663415 ]
      
      This will allow the blksize to be set zero and then use 1024 as
      default.
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NXiubo Li <xiubli@redhat.com>
      [fix to use goto out instead of return in genl_connect]
      Signed-off-by: NMike Christie <mchristi@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c688982f
    • H
      drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed · 1b155b4f
      Hans de Goede 提交于
      [ Upstream commit 9dbc88d013b79c62bd845cb9e7c0256e660967c5 ]
      
      Bail from the pci_driver probe function instead of from the drm_driver
      load function.
      
      This avoid /dev/dri/card0 temporarily getting registered and then
      unregistered again, sending unwanted add / remove udev events to
      userspace.
      
      Specifically this avoids triggering the (userspace) bug fixed by this
      plymouth merge-request:
      https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59
      
      Note that despite that being an userspace bug, not sending unnecessary
      udev events is a good idea in general.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490Reviewed-by: NMichel Dänzer <mdaenzer@redhat.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1b155b4f
    • N
      nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs · 04e0c84f
      Navid Emamdoost 提交于
      [ Upstream commit 8ce39eb5a67aee25d9f05b40b673c95b23502e3e ]
      
      In nfp_flower_spawn_vnic_reprs in the loop if initialization or the
      allocations fail memory is leaked. Appropriate releases are added.
      
      Fixes: b9452452 ("nfp: flower: add per repr private data for LAG offload")
      Signed-off-by: NNavid Emamdoost <navid.emamdoost@gmail.com>
      Acked-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      04e0c84f
    • A
      libnvdimm/region: Initialize bad block for volatile namespaces · 2e93d24a
      Aneesh Kumar K.V 提交于
      [ Upstream commit c42adf87e4e7ed77f6ffe288dc90f980d07d68df ]
      
      We do check for a bad block during namespace init and that use
      region bad block list. We need to initialize the bad block
      for volatile regions for this to work. We also observe a lockdep
      warning as below because the lock is not initialized correctly
      since we skip bad block init for volatile regions.
      
       INFO: trying to register non-static key.
       the code is fine but needs lockdep annotation.
       turning off the locking correctness validator.
       CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc1-15699-g3dee241c937e #149
       Call Trace:
       [c0000000f95cb250] [c00000000147dd84] dump_stack+0xe8/0x164 (unreliable)
       [c0000000f95cb2a0] [c00000000022ccd8] register_lock_class+0x308/0xa60
       [c0000000f95cb3a0] [c000000000229cc0] __lock_acquire+0x170/0x1ff0
       [c0000000f95cb4c0] [c00000000022c740] lock_acquire+0x220/0x270
       [c0000000f95cb580] [c000000000a93230] badblocks_check+0xc0/0x290
       [c0000000f95cb5f0] [c000000000d97540] nd_pfn_validate+0x5c0/0x7f0
       [c0000000f95cb6d0] [c000000000d98300] nd_dax_probe+0xd0/0x1f0
       [c0000000f95cb760] [c000000000d9b66c] nd_pmem_probe+0x10c/0x160
       [c0000000f95cb790] [c000000000d7f5ec] nvdimm_bus_probe+0x10c/0x240
       [c0000000f95cb820] [c000000000d0f844] really_probe+0x254/0x4e0
       [c0000000f95cb8b0] [c000000000d0fdfc] driver_probe_device+0x16c/0x1e0
       [c0000000f95cb930] [c000000000d10238] device_driver_attach+0x68/0xa0
       [c0000000f95cb970] [c000000000d1040c] __driver_attach+0x19c/0x1c0
       [c0000000f95cb9f0] [c000000000d0c4c4] bus_for_each_dev+0x94/0x130
       [c0000000f95cba50] [c000000000d0f014] driver_attach+0x34/0x50
       [c0000000f95cba70] [c000000000d0e208] bus_add_driver+0x178/0x2f0
       [c0000000f95cbb00] [c000000000d117c8] driver_register+0x108/0x170
       [c0000000f95cbb70] [c000000000d7edb0] __nd_driver_register+0xe0/0x100
       [c0000000f95cbbd0] [c000000001a6baa4] nd_pmem_driver_init+0x34/0x48
       [c0000000f95cbbf0] [c0000000000106f4] do_one_initcall+0x1d4/0x4b0
       [c0000000f95cbcd0] [c0000000019f499c] kernel_init_freeable+0x544/0x65c
       [c0000000f95cbdb0] [c000000000010d6c] kernel_init+0x2c/0x180
       [c0000000f95cbe20] [c00000000000b954] ret_from_kernel_thread+0x5c/0x68
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Link: https://lore.kernel.org/r/20190919083355.26340-1-aneesh.kumar@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2e93d24a
    • S
      thermal_hwmon: Sanitize thermal_zone type · 9025adf3
      Stefan Mavrodiev 提交于
      [ Upstream commit 8c7aa184281c01fc26f319059efb94725012921d ]
      
      When calling thermal_add_hwmon_sysfs(), the device type is sanitized by
      replacing '-' with '_'. However tz->type remains unsanitized. Thus
      calling thermal_hwmon_lookup_by_type() returns no device. And if there is
      no device, thermal_remove_hwmon_sysfs() fails with "hwmon device lookup
      failed!".
      
      The result is unregisted hwmon devices in the sysfs.
      
      Fixes: 409ef0ba ("thermal_hwmon: Sanitize attribute name passed to hwmon")
      Signed-off-by: NStefan Mavrodiev <stefan@olimex.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      9025adf3
    • I
      thermal: Fix use-after-free when unregistering thermal zone device · c01a9dbe
      Ido Schimmel 提交于
      [ Upstream commit 1851799e1d2978f68eea5d9dff322e121dcf59c1 ]
      
      thermal_zone_device_unregister() cancels the delayed work that polls the
      thermal zone, but it does not wait for it to finish. This is racy with
      respect to the freeing of the thermal zone device, which can result in a
      use-after-free [1].
      
      Fix this by waiting for the delayed work to finish before freeing the
      thermal zone device. Note that thermal_zone_device_set_polling() is
      never invoked from an atomic context, so it is safe to call
      cancel_delayed_work_sync() that can block.
      
      [1]
      [  +0.002221] ==================================================================
      [  +0.000064] BUG: KASAN: use-after-free in __mutex_lock+0x1076/0x11c0
      [  +0.000016] Read of size 8 at addr ffff8881e48e0450 by task kworker/1:0/17
      
      [  +0.000023] CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.2.0-rc6-custom-02495-g8e73ca3be4af #1701
      [  +0.000010] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
      [  +0.000016] Workqueue: events_freezable_power_ thermal_zone_device_check
      [  +0.000012] Call Trace:
      [  +0.000021]  dump_stack+0xa9/0x10e
      [  +0.000020]  print_address_description.cold.2+0x9/0x25e
      [  +0.000018]  __kasan_report.cold.3+0x78/0x9d
      [  +0.000016]  kasan_report+0xe/0x20
      [  +0.000016]  __mutex_lock+0x1076/0x11c0
      [  +0.000014]  step_wise_throttle+0x72/0x150
      [  +0.000018]  handle_thermal_trip+0x167/0x760
      [  +0.000019]  thermal_zone_device_update+0x19e/0x5f0
      [  +0.000019]  process_one_work+0x969/0x16f0
      [  +0.000017]  worker_thread+0x91/0xc40
      [  +0.000014]  kthread+0x33d/0x400
      [  +0.000015]  ret_from_fork+0x3a/0x50
      
      [  +0.000020] Allocated by task 1:
      [  +0.000015]  save_stack+0x19/0x80
      [  +0.000015]  __kasan_kmalloc.constprop.4+0xc1/0xd0
      [  +0.000014]  kmem_cache_alloc_trace+0x152/0x320
      [  +0.000015]  thermal_zone_device_register+0x1b4/0x13a0
      [  +0.000015]  mlxsw_thermal_init+0xc92/0x23d0
      [  +0.000014]  __mlxsw_core_bus_device_register+0x659/0x11b0
      [  +0.000013]  mlxsw_core_bus_device_register+0x3d/0x90
      [  +0.000013]  mlxsw_pci_probe+0x355/0x4b0
      [  +0.000014]  local_pci_probe+0xc3/0x150
      [  +0.000013]  pci_device_probe+0x280/0x410
      [  +0.000013]  really_probe+0x26a/0xbb0
      [  +0.000013]  driver_probe_device+0x208/0x2e0
      [  +0.000013]  device_driver_attach+0xfe/0x140
      [  +0.000013]  __driver_attach+0x110/0x310
      [  +0.000013]  bus_for_each_dev+0x14b/0x1d0
      [  +0.000013]  driver_register+0x1c0/0x400
      [  +0.000015]  mlxsw_sp_module_init+0x5d/0xd3
      [  +0.000014]  do_one_initcall+0x239/0x4dd
      [  +0.000013]  kernel_init_freeable+0x42b/0x4e8
      [  +0.000012]  kernel_init+0x11/0x18b
      [  +0.000013]  ret_from_fork+0x3a/0x50
      
      [  +0.000015] Freed by task 581:
      [  +0.000013]  save_stack+0x19/0x80
      [  +0.000014]  __kasan_slab_free+0x125/0x170
      [  +0.000013]  kfree+0xf3/0x310
      [  +0.000013]  thermal_release+0xc7/0xf0
      [  +0.000014]  device_release+0x77/0x200
      [  +0.000014]  kobject_put+0x1a8/0x4c0
      [  +0.000014]  device_unregister+0x38/0xc0
      [  +0.000014]  thermal_zone_device_unregister+0x54e/0x6a0
      [  +0.000014]  mlxsw_thermal_fini+0x184/0x35a
      [  +0.000014]  mlxsw_core_bus_device_unregister+0x10a/0x640
      [  +0.000013]  mlxsw_devlink_core_bus_device_reload+0x92/0x210
      [  +0.000015]  devlink_nl_cmd_reload+0x113/0x1f0
      [  +0.000014]  genl_family_rcv_msg+0x700/0xee0
      [  +0.000013]  genl_rcv_msg+0xca/0x170
      [  +0.000013]  netlink_rcv_skb+0x137/0x3a0
      [  +0.000012]  genl_rcv+0x29/0x40
      [  +0.000013]  netlink_unicast+0x49b/0x660
      [  +0.000013]  netlink_sendmsg+0x755/0xc90
      [  +0.000013]  __sys_sendto+0x3de/0x430
      [  +0.000013]  __x64_sys_sendto+0xe2/0x1b0
      [  +0.000013]  do_syscall_64+0xa4/0x4d0
      [  +0.000013]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      [  +0.000017] The buggy address belongs to the object at ffff8881e48e0008
                     which belongs to the cache kmalloc-2k of size 2048
      [  +0.000012] The buggy address is located 1096 bytes inside of
                     2048-byte region [ffff8881e48e0008, ffff8881e48e0808)
      [  +0.000007] The buggy address belongs to the page:
      [  +0.000012] page:ffffea0007923800 refcount:1 mapcount:0 mapping:ffff88823680d0c0 index:0x0 compound_mapcount: 0
      [  +0.000020] flags: 0x200000000010200(slab|head)
      [  +0.000019] raw: 0200000000010200 ffffea0007682008 ffffea00076ab808 ffff88823680d0c0
      [  +0.000016] raw: 0000000000000000 00000000000d000d 00000001ffffffff 0000000000000000
      [  +0.000007] page dumped because: kasan: bad access detected
      
      [  +0.000012] Memory state around the buggy address:
      [  +0.000012]  ffff8881e48e0300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  +0.000012]  ffff8881e48e0380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  +0.000012] >ffff8881e48e0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  +0.000008]                                                  ^
      [  +0.000012]  ffff8881e48e0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  +0.000012]  ffff8881e48e0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  +0.000007] ==================================================================
      
      Fixes: b1569e99 ("ACPI: move thermal trip handling to generic thermal layer")
      Reported-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c01a9dbe
    • S
      ntb: point to right memory window index · 55ebeb4e
      Sanjay R Mehta 提交于
      [ Upstream commit ae89339b08f3fe02457ec9edd512ddc3d246d0f8 ]
      
      second parameter of ntb_peer_mw_get_addr is pointing to wrong memory
      window index by passing "peer gidx" instead of "local gidx".
      
      For ex, "local gidx" value is '0' and "peer gidx" value is '1', then
      
      on peer side ntb_mw_set_trans() api is used as below with gidx pointing to
      local side gidx which is '0', so memroy window '0' is chosen and XLAT '0'
      will be programmed by peer side.
      
          ntb_mw_set_trans(perf->ntb, peer->pidx, peer->gidx, peer->inbuf_xlat,
                          peer->inbuf_size);
      
      Now, on local side ntb_peer_mw_get_addr() is been used as below with gidx
      pointing to "peer gidx" which is '1', so pointing to memory window '1'
      instead of memory window '0'.
      
          ntb_peer_mw_get_addr(perf->ntb,  peer->gidx, &phys_addr,
                              &peer->outbuf_size);
      
      So this patch pass "local gidx" as parameter to ntb_peer_mw_get_addr().
      Signed-off-by: NSanjay R Mehta <sanju.mehta@amd.com>
      Signed-off-by: NJon Mason <jdmason@kudzu.us>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      55ebeb4e
    • F
      pwm: stm32-lp: Add check in case requested period cannot be achieved · 65348659
      Fabrice Gasnier 提交于
      [ Upstream commit c91e3234c6035baf5a79763cb4fcd5d23ce75c2b ]
      
      LPTimer can use a 32KHz clock for counting. It depends on clock tree
      configuration. In such a case, PWM output frequency range is limited.
      Although unlikely, nothing prevents user from requesting a PWM frequency
      above counting clock (32KHz for instance):
      - This causes (prd - 1) = 0xffff to be written in ARR register later in
      the apply() routine.
      This results in badly configured PWM period (and also duty_cycle).
      Add a check to report an error is such a case.
      Signed-off-by: NFabrice Gasnier <fabrice.gasnier@st.com>
      Reviewed-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      65348659
    • T
      drm/amdgpu: Check for valid number of registers to read · 1c70ae6a
      Trek 提交于
      [ Upstream commit 73d8e6c7b841d9bf298c8928f228fb433676635c ]
      
      Do not try to allocate any amount of memory requested by the user.
      Instead limit it to 128 registers. Actually the longest series of
      consecutive allowed registers are 48, mmGB_TILE_MODE0-31 and
      mmGB_MACROTILE_MODE0-15 (0x2644-0x2673).
      
      Bug: https://bugs.freedesktop.org/show_bug.cgi?id=111273Signed-off-by: NTrek <trek00@inbox.ru>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      1c70ae6a
    • F
      drm/amdgpu: Fix KFD-related kernel oops on Hawaii · e0af3b19
      Felix Kuehling 提交于
      [ Upstream commit dcafbd50f2e4d5cc964aae409fb5691b743fba23 ]
      
      Hawaii needs to flush caches explicitly, submitting an IB in a user
      VMID from kernel mode. There is no s_fence in this case.
      
      Fixes: eb3961a5 ("drm/amdgpu: remove fence context from the job")
      Signed-off-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      Reviewed-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e0af3b19
    • R
      watchdog: aspeed: Add support for AST2600 · f217883b
      Ryan Chen 提交于
      [ Upstream commit b3528b4874480818e38e4da019d655413c233e6a ]
      
      The ast2600 can be supported by the same code as the ast2500.
      Signed-off-by: NRyan Chen <ryan_chen@aspeedtech.com>
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20190819051738.17370-3-joel@jms.id.auSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NWim Van Sebroeck <wim@linux-watchdog.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      f217883b
    • I
      xen/pci: reserve MCFG areas earlier · 2bc2a90a
      Igor Druzhinin 提交于
      [ Upstream commit a4098bc6eed5e31e0391bcc068e61804c98138df ]
      
      If MCFG area is not reserved in E820, Xen by default will defer its usage
      until Dom0 registers it explicitly after ACPI parser recognizes it as
      a reserved resource in DSDT. Having it reserved in E820 is not
      mandatory according to "PCI Firmware Specification, rev 3.2" (par. 4.1.2)
      and firmware is free to keep a hole in E820 in that place. Xen doesn't know
      what exactly is inside this hole since it lacks full ACPI view of the
      platform therefore it's potentially harmful to access MCFG region
      without additional checks as some machines are known to provide
      inconsistent information on the size of the region.
      
      Now xen_mcfg_late() runs after acpi_init() which is too late as some basic
      PCI enumeration starts exactly there as well. Trying to register a device
      prior to MCFG reservation causes multiple problems with PCIe extended
      capability initializations in Xen (e.g. SR-IOV VF BAR sizing). There are
      no convenient hooks for us to subscribe to so register MCFG areas earlier
      upon the first invocation of xen_add_device(). It should be safe to do once
      since all the boot time buses must have their MCFG areas in MCFG table
      already and we don't support PCI bus hot-plug.
      Signed-off-by: NIgor Druzhinin <igor.druzhinin@citrix.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2bc2a90a
    • V
      s390/cio: avoid calling strlen on null pointer · 16c75eb1
      Vasily Gorbik 提交于
      commit ea298e6ee8b34b3ed4366be7eb799d0650ebe555 upstream.
      
      Fix the following kasan finding:
      BUG: KASAN: global-out-of-bounds in ccwgroup_create_dev+0x850/0x1140
      Read of size 1 at addr 0000000000000000 by task systemd-udevd.r/561
      
      CPU: 30 PID: 561 Comm: systemd-udevd.r Tainted: G    B
      Hardware name: IBM 3906 M04 704 (LPAR)
      Call Trace:
      ([<0000000231b3db7e>] show_stack+0x14e/0x1a8)
       [<0000000233826410>] dump_stack+0x1d0/0x218
       [<000000023216fac4>] print_address_description+0x64/0x380
       [<000000023216f5a8>] __kasan_report+0x138/0x168
       [<00000002331b8378>] ccwgroup_create_dev+0x850/0x1140
       [<00000002332b618a>] group_store+0x3a/0x50
       [<00000002323ac706>] kernfs_fop_write+0x246/0x3b8
       [<00000002321d409a>] vfs_write+0x132/0x450
       [<00000002321d47da>] ksys_write+0x122/0x208
       [<0000000233877102>] system_call+0x2a6/0x2c8
      
      Triggered by:
      openat(AT_FDCWD, "/sys/bus/ccwgroup/drivers/qeth/group",
      		O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 16
      write(16, "0.0.bd00,0.0.bd01,0.0.bd02", 26) = 26
      
      The problem is that __get_next_id in ccwgroup_create_dev might set "buf"
      buffer pointer to NULL and explicit check for that is required.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: NSebastian Ott <sebott@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      16c75eb1
    • J
      ieee802154: atusb: fix use-after-free at disconnect · 3f41e88f
      Johan Hovold 提交于
      commit 7fd25e6fc035f4b04b75bca6d7e8daa069603a76 upstream.
      
      The disconnect callback was accessing the hardware-descriptor private
      data after having having freed it.
      
      Fixes: 7490b008 ("ieee802154: add support for atusb transceiver")
      Cc: stable <stable@vger.kernel.org>     # 4.2
      Cc: Alexander Aring <alex.aring@gmail.com>
      Reported-by: syzbot+f4509a9138a1472e7e80@syzkaller.appspotmail.com
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f41e88f
    • J
      xen/xenbus: fix self-deadlock after killing user process · 975859bb
      Juergen Gross 提交于
      commit a8fabb38525c51a094607768bac3ba46b3f4a9d5 upstream.
      
      In case a user process using xenbus has open transactions and is killed
      e.g. via ctrl-C the following cleanup of the allocated resources might
      result in a deadlock due to trying to end a transaction in the xenbus
      worker thread:
      
      [ 2551.474706] INFO: task xenbus:37 blocked for more than 120 seconds.
      [ 2551.492215]       Tainted: P           OE     5.0.0-29-generic #5
      [ 2551.510263] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 2551.528585] xenbus          D    0    37      2 0x80000080
      [ 2551.528590] Call Trace:
      [ 2551.528603]  __schedule+0x2c0/0x870
      [ 2551.528606]  ? _cond_resched+0x19/0x40
      [ 2551.528632]  schedule+0x2c/0x70
      [ 2551.528637]  xs_talkv+0x1ec/0x2b0
      [ 2551.528642]  ? wait_woken+0x80/0x80
      [ 2551.528645]  xs_single+0x53/0x80
      [ 2551.528648]  xenbus_transaction_end+0x3b/0x70
      [ 2551.528651]  xenbus_file_free+0x5a/0x160
      [ 2551.528654]  xenbus_dev_queue_reply+0xc4/0x220
      [ 2551.528657]  xenbus_thread+0x7de/0x880
      [ 2551.528660]  ? wait_woken+0x80/0x80
      [ 2551.528665]  kthread+0x121/0x140
      [ 2551.528667]  ? xb_read+0x1d0/0x1d0
      [ 2551.528670]  ? kthread_park+0x90/0x90
      [ 2551.528673]  ret_from_fork+0x35/0x40
      
      Fix this by doing the cleanup via a workqueue instead.
      Reported-by: NJames Dingwall <james@dingwall.me.uk>
      Fixes: fd8aa909 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
      Cc: <stable@vger.kernel.org> # 4.11
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      975859bb
    • R
      mmc: sdhci-of-esdhc: set DMA snooping based on DMA coherence · 7ed2867c
      Russell King 提交于
      commit 121bd08b029e03404c451bb237729cdff76eafed upstream.
      
      We must not unconditionally set the DMA snoop bit; if the DMA API is
      assuming that the device is not DMA coherent, and the device snoops the
      CPU caches, the device can see stale cache lines brought in by
      speculative prefetch.
      
      This leads to the device seeing stale data, potentially resulting in
      corrupted data transfers.  Commonly, this results in a descriptor fetch
      error such as:
      
      mmc0: ADMA error
      mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
      mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00002202
      mmc0: sdhci: Blk size:  0x00000008 | Blk cnt:  0x00000001
      mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000013
      mmc0: sdhci: Present:   0x01f50008 | Host ctl: 0x00000038
      mmc0: sdhci: Power:     0x00000003 | Blk gap:  0x00000000
      mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x000040d8
      mmc0: sdhci: Timeout:   0x00000003 | Int stat: 0x00000001
      mmc0: sdhci: Int enab:  0x037f108f | Sig enab: 0x037f108b
      mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00002202
      mmc0: sdhci: Caps:      0x35fa0000 | Caps_1:   0x0000af00
      mmc0: sdhci: Cmd:       0x0000333a | Max curr: 0x00000000
      mmc0: sdhci: Resp[0]:   0x00000920 | Resp[1]:  0x001d8a33
      mmc0: sdhci: Resp[2]:   0x325b5900 | Resp[3]:  0x3f400e00
      mmc0: sdhci: Host ctl2: 0x00000000
      mmc0: sdhci: ADMA Err:  0x00000009 | ADMA Ptr: 0x000000236d43820c
      mmc0: sdhci: ============================================
      mmc0: error -5 whilst initialising SD card
      
      but can lead to other errors, and potentially direct the SDHCI
      controller to read/write data to other memory locations (e.g. if a valid
      descriptor is visible to the device in a stale cache line.)
      
      Fix this by ensuring that the DMA snoop bit corresponds with the
      behaviour of the DMA API.  Since the driver currently only supports DT,
      use of_dma_is_coherent().  Note that device_get_dma_attr() can not be
      used as that risks re-introducing this bug if/when the driver is
      converted to ACPI.
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ed2867c
    • R
      mmc: sdhci: improve ADMA error reporting · 4509a19d
      Russell King 提交于
      commit d1c536e3177390da43d99f20143b810c35433d1f upstream.
      
      ADMA errors are potentially data corrupting events; although we print
      the register state, we do not usefully print the ADMA descriptors.
      Worse than that, we print them by referencing their virtual address
      which is meaningless when the register state gives us the DMA address
      of the failing descriptor.
      
      Print the ADMA descriptors giving their DMA addresses rather than their
      virtual addresses, and print them using SDHCI_DUMP() rather than DBG().
      
      We also do not show the correct value of the interrupt status register;
      the register dump shows the current value, after we have cleared the
      pending interrupts we are going to service.  What is more useful is to
      print the interrupts that _were_ pending at the time the ADMA error was
      encountered.  Fix that too.
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4509a19d
    • X
      drm/i915/gvt: update vgpu workload head pointer correctly · 873f49d6
      Xiaolin Zhang 提交于
      commit 0a3242bdb47713e09cb004a0ba4947d3edf82d8a upstream.
      
      when creating a vGPU workload, the guest context head pointer should
      be updated correctly by comparing with the exsiting workload in the
      guest worklod queue including the current running context.
      
      in some situation, there is a running context A and then received 2 new
      vGPU workload context B and A. in the new workload context A, it's head
      pointer should be updated with the running context A's tail.
      
      v2: walk through guest workload list in backward way.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NXiaolin Zhang <xiaolin.zhang@intel.com>
      Reviewed-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      873f49d6
    • L
      drm/nouveau/kms/nv50-: Don't create MSTMs for eDP connectors · 198bc704
      Lyude Paul 提交于
      commit 698c1aa9f83b618de79e9e5e19a58f70a4a6ae0f upstream.
      
      On the ThinkPad P71, we have one eDP connector exposed along with 5 DP
      connectors, resulting in a total of 11 TMDS encoders. Since the GPU on
      this system is also capable of MST, we create an additional 4 fake MST
      encoders for each DP port. Unfortunately, we also do this for the eDP
      port as well, resulting in:
      
        1 eDP port: +1 TMDS encoder
                    +4 DPMST encoders
        5 DP ports: +2 TMDS encoders
                    +4 DPMST encoders
      	      *5 ports
      	      == 35 encoders
      
      Which breaks things, since DRM has a hard coded limit of 32 encoders.
      So, fix this by not creating MSTMs for any eDP connectors. This brings
      us down to 31 encoders, although we can do better.
      
      This fixes driver probing for nouveau on the ThinkPad P71.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      198bc704
    • S
      drm/msm/dsi: Fix return value check for clk_get_parent · 7a85c867
      Sean Paul 提交于
      commit 5fb9b797d5ccf311ae4aba69e86080d47668b5f7 upstream.
      
      clk_get_parent returns an error pointer upon failure, not NULL. So the
      checks as they exist won't catch a failure. This patch changes the
      checks and the return values to properly handle an error pointer.
      
      Fixes: c4d8cfe5 ("drm/msm/dsi: add implementation for helper functions")
      Cc: Sibi Sankar <sibis@codeaurora.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Rob Clark <robdclark@chromium.org>
      Cc: <stable@vger.kernel.org> # v4.19+
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7a85c867
    • T
      drm/omap: fix max fclk divider for omap36xx · 0e45633f
      Tomi Valkeinen 提交于
      commit e2c4ed148cf3ec8669a1d90dc66966028e5fad70 upstream.
      
      The OMAP36xx and AM/DM37x TRMs say that the maximum divider for DSS fclk
      (in CM_CLKSEL_DSS) is 32. Experimentation shows that this is not
      correct, and using divider of 32 breaks DSS with a flood or underflows
      and sync losts. Dividers up to 31 seem to work fine.
      
      There is another patch to the DT files to limit the divider correctly,
      but as the DSS driver also needs to know the maximum divider to be able
      to iteratively find good rates, we also need to do the fix in the DSS
      driver.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Cc: Adam Ford <aford173@gmail.com>
      Cc: stable@vger.kernel.org
      Link: https://patchwork.freedesktop.org/patch/msgid/20191002122542.8449-1-tomi.valkeinen@ti.comTested-by: NAdam Ford <aford173@gmail.com>
      Reviewed-by: NJyri Sarha <jsarha@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e45633f
    • R
      watchdog: imx2_wdt: fix min() calculation in imx2_wdt_set_timeout · 22f28afd
      Rasmus Villemoes 提交于
      commit 144783a80cd2cbc45c6ce17db649140b65f203dd upstream.
      
      Converting from ms to s requires dividing by 1000, not multiplying. So
      this is currently taking the smaller of new_timeout and 1.28e8,
      i.e. effectively new_timeout.
      
      The driver knows what it set max_hw_heartbeat_ms to, so use that
      value instead of doing a division at run-time.
      
      FWIW, this can easily be tested by booting into a busybox shell and
      doing "watchdog -t 5 -T 130 /dev/watchdog" - without this patch, the
      watchdog fires after 130&127 == 2 seconds.
      
      Fixes: b07e228eee69 "watchdog: imx2_wdt: Fix set_timeout for big timeout values"
      Cc: stable@vger.kernel.org # 5.2 plus anything the above got backported to
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20190812131356.23039-1-linux@rasmusvillemoes.dkSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NWim Van Sebroeck <wim@linux-watchdog.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22f28afd
    • S
      PCI: Restore Resizable BAR size bits correctly for 1MB BARs · e7cf8cc7
      Sumit Saxena 提交于
      commit d2182b2d4b71ff0549a07f414d921525fade707b upstream.
      
      In a Resizable BAR Control Register, bits 13:8 control the size of the BAR.
      The encoded values of these bits are as follows (see PCIe r5.0, sec
      7.8.6.3):
      
        Value    BAR size
           0     1 MB (2^20 bytes)
           1     2 MB (2^21 bytes)
           2     4 MB (2^22 bytes)
         ...
          43     8 EB (2^63 bytes)
      
      Previously we incorrectly set the BAR size bits for a 1 MB BAR to 0x1f
      instead of 0, so devices that support that size, e.g., new megaraid_sas and
      mpt3sas adapters, fail to initialize during resume from S3 sleep.
      
      Correctly calculate the BAR size bits for Resizable BAR control registers.
      
      Link: https://lore.kernel.org/r/20190725192552.24295-1-sumit.saxena@broadcom.com
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203939
      Fixes: d3252ace ("PCI: Restore resized BAR state on resume")
      Signed-off-by: NSumit Saxena <sumit.saxena@broadcom.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NChristian König <christian.koenig@amd.com>
      Cc: stable@vger.kernel.org	# v4.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7cf8cc7
    • J
      PCI: vmd: Fix shadow offsets to reflect spec changes · 956ce989
      Jon Derrick 提交于
      commit a1a30170138c9c5157bd514ccd4d76b47060f29b upstream.
      
      The shadow offset scratchpad was moved to 0x2000-0x2010. Update the
      location to get the correct shadow offset.
      
      Fixes: 6788958e ("PCI: vmd: Assign membar addresses from shadow registers")
      Signed-off-by: NJon Derrick <jonathan.derrick@intel.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: stable@vger.kernel.org # v5.2+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      956ce989
    • M
      power: supply: sbs-battery: only return health when battery present · 022ca58f
      Michael Nosthoff 提交于
      commit fe55e770327363304c4111423e6f7ff3c650136d upstream.
      
      when the battery is set to sbs-mode and  no gpio detection is enabled
      "health" is always returning a value even when the battery is not present.
      All other fields return "not present".
      This leads to a scenario where the driver is constantly switching between
      "present" and "not present" state. This generates a lot of constant
      traffic on the i2c.
      
      This commit changes the response of "health" to an error when the battery
      is not responding leading to a consistent "not present" state.
      
      Fixes: 76b16f4c ("power: supply: sbs-battery: don't assume MANUFACTURER_DATA formats")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMichael Nosthoff <committed@heine.so>
      Reviewed-by: NBrian Norris <briannorris@chromium.org>
      Tested-by: NBrian Norris <briannorris@chromium.org>
      Signed-off-by: NSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      022ca58f
    • M
      power: supply: sbs-battery: use correct flags field · 5cb6dd82
      Michael Nosthoff 提交于
      commit 99956a9e08251a1234434b492875b1eaff502a12 upstream.
      
      the type flag is stored in the chip->flags field not in the
      client->flags field. This currently leads to never using the ti
      specific health function as client->flags doesn't use that bit.
      So it's always falling back to the general one.
      
      Fixes: 76b16f4c ("power: supply: sbs-battery: don't assume MANUFACTURER_DATA formats")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMichael Nosthoff <committed@heine.so>
      Reviewed-by: NBrian Norris <briannorris@chromium.org>
      Reviewed-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Signed-off-by: NSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5cb6dd82
    • G
      crypto: ccree - use the full crypt length value · a0dc60ac
      Gilad Ben-Yossef 提交于
      commit 7a4be6c113c1f721818d1e3722a9015fe393295c upstream.
      
      In case of AEAD decryption verifcation error we were using the
      wrong value to zero out the plaintext buffer leaving the end of
      the buffer with the false plaintext.
      Signed-off-by: NGilad Ben-Yossef <gilad@benyossef.com>
      Fixes: ff27e85a ("crypto: ccree - add AEAD support")
      CC: stable@vger.kernel.org # v4.17+
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a0dc60ac
    • G
      crypto: ccree - account for TEE not ready to report · f5c087a0
      Gilad Ben-Yossef 提交于
      commit 76a95bd8f9e10cade9c4c8df93b5c20ff45dc0f5 upstream.
      
      When ccree driver runs it checks the state of the Trusted Execution
      Environment CryptoCell driver before proceeding. We did not account
      for cases where the TEE side is not ready or not available at all.
      Fix it by only considering TEE error state after sync with the TEE
      side driver.
      Signed-off-by: NGilad Ben-Yossef <gilad@benyossef.com>
      Fixes: ab8ec965 ("crypto: ccree - add FIPS support")
      CC: stable@vger.kernel.org # v4.17+
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5c087a0
    • H
      crypto: caam - fix concurrency issue in givencrypt descriptor · 561bf930
      Horia Geantă 提交于
      commit 48f89d2a2920166c35b1c0b69917dbb0390ebec7 upstream.
      
      IV transfer from ofifo to class2 (set up at [29][30]) is not guaranteed
      to be scheduled before the data transfer from ofifo to external memory
      (set up at [38]:
      
      [29] 10FA0004           ld: ind-nfifo (len=4) imm
      [30] 81F00010               <nfifo_entry: ofifo->class2 type=msg len=16>
      [31] 14820004           ld: ccb2-datasz len=4 offs=0 imm
      [32] 00000010               data:0x00000010
      [33] 8210010D    operation: cls1-op aes cbc init-final enc
      [34] A8080B04         math: (seqin + math0)->vseqout len=4
      [35] 28000010    seqfifold: skip len=16
      [36] A8080A04         math: (seqin + math0)->vseqin len=4
      [37] 2F1E0000    seqfifold: both msg1->2-last2-last1 len=vseqinsz
      [38] 69300000   seqfifostr: msg len=vseqoutsz
      [39] 5C20000C      seqstr: ccb2 ctx len=12 offs=0
      
      If ofifo -> external memory transfer happens first, DECO will hang
      (issuing a Watchdog Timeout error, if WDOG is enabled) waiting for
      data availability in ofifo for the ofifo -> c2 ififo transfer.
      
      Make sure IV transfer happens first by waiting for all CAAM internal
      transfers to end before starting payload transfer.
      
      New descriptor with jump command inserted at [37]:
      
      [..]
      [36] A8080A04         math: (seqin + math0)->vseqin len=4
      [37] A1000401         jump: jsl1 all-match[!nfifopend] offset=[01] local->[38]
      [38] 2F1E0000    seqfifold: both msg1->2-last2-last1 len=vseqinsz
      [39] 69300000   seqfifostr: msg len=vseqoutsz
      [40] 5C20000C      seqstr: ccb2 ctx len=12 offs=0
      
      [Note: the issue is present in the descriptor from the very beginning
      (cf. Fixes tag). However I've marked it v4.19+ since it's the oldest
      maintained kernel that the patch applies clean against.]
      
      Cc: <stable@vger.kernel.org> # v4.19+
      Fixes: 1acebad3 ("crypto: caam - faster aead implementation")
      Signed-off-by: NHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      561bf930
    • W
      crypto: cavium/zip - Add missing single_release() · 3683dd70
      Wei Yongjun 提交于
      commit c552ffb5c93d9d65aaf34f5f001c4e7e8484ced1 upstream.
      
      When using single_open() for opening, single_release() should be
      used instead of seq_release(), otherwise there is a memory leak.
      
      Fixes: 09ae5d37 ("crypto: zip - Add Compression/Decompression statistics")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3683dd70
    • A
      crypto: qat - Silence smp_processor_id() warning · 9349108a
      Alexander Sverdlin 提交于
      commit 1b82feb6c5e1996513d0fb0bbb475417088b4954 upstream.
      
      It seems that smp_processor_id() is only used for a best-effort
      load-balancing, refer to qat_crypto_get_instance_node(). It's not feasible
      to disable preemption for the duration of the crypto requests. Therefore,
      just silence the warning. This commit is similar to e7a9b05c
      ("crypto: cavium - Fix smp_processor_id() warnings").
      
      Silences the following splat:
      BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_test/2904
      caller is qat_alg_ablkcipher_setkey+0x300/0x4a0 [intel_qat]
      CPU: 1 PID: 2904 Comm: cryptomgr_test Tainted: P           O    4.14.69 #1
      ...
      Call Trace:
       dump_stack+0x5f/0x86
       check_preemption_disabled+0xd3/0xe0
       qat_alg_ablkcipher_setkey+0x300/0x4a0 [intel_qat]
       skcipher_setkey_ablkcipher+0x2b/0x40
       __test_skcipher+0x1f3/0xb20
       ? cpumask_next_and+0x26/0x40
       ? find_busiest_group+0x10e/0x9d0
       ? preempt_count_add+0x49/0xa0
       ? try_module_get+0x61/0xf0
       ? crypto_mod_get+0x15/0x30
       ? __kmalloc+0x1df/0x1f0
       ? __crypto_alloc_tfm+0x116/0x180
       ? crypto_skcipher_init_tfm+0xa6/0x180
       ? crypto_create_tfm+0x4b/0xf0
       test_skcipher+0x21/0xa0
       alg_test_skcipher+0x3f/0xa0
       alg_test.part.6+0x126/0x2a0
       ? finish_task_switch+0x21b/0x260
       ? __schedule+0x1e9/0x800
       ? __wake_up_common+0x8d/0x140
       cryptomgr_test+0x40/0x50
       kthread+0xff/0x130
       ? cryptomgr_notify+0x540/0x540
       ? kthread_create_on_node+0x70/0x70
       ret_from_fork+0x24/0x50
      
      Fixes: ed8ccaef ("crypto: qat - Add support for SRIOV")
      Cc: stable@vger.kernel.org
      Signed-off-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9349108a
    • M
      can: mcp251x: mcp251x_hw_reset(): allow more time after a reset · 4aaea17d
      Marc Kleine-Budde 提交于
      commit d84ea2123f8d27144e3f4d58cd88c9c6ddc799de upstream.
      
      Some boards take longer than 5ms to power up after a reset, so allow
      some retries attempts before giving up.
      
      Fixes: ff06d611 ("can: mcp251x: Improve mcp251x_hw_reset()")
      Cc: linux-stable <stable@vger.kernel.org>
      Tested-by: NSean Nyekjaer <sean@geanix.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4aaea17d
    • D
      PM / devfreq: tegra: Fix kHz to Hz conversion · 42b888f6
      Dmitry Osipenko 提交于
      commit 62bacb06b9f08965c4ef10e17875450490c948c0 upstream.
      
      The kHz to Hz is incorrectly converted in a few places in the code,
      this results in a wrong frequency being calculated because devfreq core
      uses OPP frequencies that are given in Hz to clamp the rate, while
      tegra-devfreq gives to the core value in kHz and then it also expects to
      receive value in kHz from the core. In a result memory freq is always set
      to a value which is close to ULONG_MAX because of the bug. Hence the EMC
      frequency is always capped to the maximum and the driver doesn't do
      anything useful. This patch was tested on Tegra30 and Tegra124 SoC's, EMC
      frequency scaling works properly now.
      
      Cc: <stable@vger.kernel.org> # 4.14+
      Tested-by: NSteev Klimaszewski <steev@kali.org>
      Reviewed-by: NChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: NDmitry Osipenko <digetx@gmail.com>
      Acked-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42b888f6
    • M
      nbd: fix max number of supported devs · 9f0f39c9
      Mike Christie 提交于
      commit e9e006f5fcf2bab59149cb38a48a4817c1b538b4 upstream.
      
      This fixes a bug added in 4.10 with commit:
      
      commit 9561a7ad
      Author: Josef Bacik <jbacik@fb.com>
      Date:   Tue Nov 22 14:04:40 2016 -0500
      
          nbd: add multi-connection support
      
      that limited the number of devices to 256. Before the patch we could
      create 1000s of devices, but the patch switched us from using our
      own thread to using a work queue which has a default limit of 256
      active works.
      
      The problem is that our recv_work function sits in a loop until
      disconnection but only handles IO for one connection. The work is
      started when the connection is started/restarted, but if we end up
      creating 257 or more connections, the queue_work call just queues
      connection257+'s recv_work and that waits for connection 1 - 256's
      recv_work to be disconnected and that work instance completing.
      
      Instead of reverting back to kthreads, this has us allocate a
      workqueue_struct per device, so we can block in the work.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NMike Christie <mchristi@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f0f39c9
    • V
      s390/cio: exclude subchannels with no parent from pseudo check · 46cb14a5
      Vasily Gorbik 提交于
      commit ab5758848039de9a4b249d46e4ab591197eebaf2 upstream.
      
      ccw console is created early in start_kernel and used before css is
      initialized or ccw console subchannel is registered. Until then console
      subchannel does not have a parent. For that reason assume subchannels
      with no parent are not pseudo subchannels. This fixes the following
      kasan finding:
      
      BUG: KASAN: global-out-of-bounds in sch_is_pseudo_sch+0x8e/0x98
      Read of size 8 at addr 00000000000005e8 by task swapper/0/0
      
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.3.0-rc8-07370-g6ac43dd12538 #2
      Hardware name: IBM 2964 NC9 702 (z/VM 6.4.0)
      Call Trace:
      ([<000000000012cd76>] show_stack+0x14e/0x1e0)
       [<0000000001f7fb44>] dump_stack+0x1a4/0x1f8
       [<00000000007d7afc>] print_address_description+0x64/0x3c8
       [<00000000007d75f6>] __kasan_report+0x14e/0x180
       [<00000000018a2986>] sch_is_pseudo_sch+0x8e/0x98
       [<000000000189b950>] cio_enable_subchannel+0x1d0/0x510
       [<00000000018cac7c>] ccw_device_recognition+0x12c/0x188
       [<0000000002ceb1a8>] ccw_device_enable_console+0x138/0x340
       [<0000000002cf1cbe>] con3215_init+0x25e/0x300
       [<0000000002c8770a>] console_init+0x68a/0x9b8
       [<0000000002c6a3d6>] start_kernel+0x4fe/0x728
       [<0000000000100070>] startup_continue+0x70/0xd0
      
      Cc: stable@vger.kernel.org
      Reviewed-by: NSebastian Ott <sebott@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      46cb14a5
  2. 08 10月, 2019 5 次提交