1. 25 Jun, 2019 39 commits
    • Mike Marciniszyn's avatar
      IB/rdmavt: Fix alloc_qpn() WARN_ON() · 3fe551cc
      Mike Marciniszyn authored
      [ Upstream commit 2abae62a ]
      
      The qpn allocation logic has a WARN_ON() that intends to detect the use of
      an index that will introduce bits in the lower order bits of the QOS bits
      in the QPN.
      
      Unfortunately, it has the following bugs:
      - it misfires when wrapping QPN allocation for non-QOS
      - it doesn't correctly detect low order QOS bits (despite the comment)
      
      The WARN_ON() should not be applied to non-QOS (qos_shift == 1).
      
      Additionally, it SHOULD test the qpn bits per the table below:
      
      2 data VLs:   [qp7, qp6, qp5, qp4, qp3, qp2, qp1] ^
                    [  0,   0,   0,   0,   0,   0, sc0],  qp bit 1 always 0*
      3-4 data VLs: [qp7, qp6, qp5, qp4, qp3, qp2, qp1] ^
                    [  0,   0,   0,   0,   0, sc1, sc0], qp bits [21] always 0
      5-8 data VLs: [qp7, qp6, qp5, qp4, qp3, qp2, qp1] ^
                    [  0,   0,   0,   0, sc2, sc1, sc0] qp bits [321] always 0
      
      Fix by qualifying the warning for qos_shift > 1 and producing the correct
      mask to insure the above bits are zero without generating a superfluous
      warning.
      
      Fixes: 501edc42 ("IB/rdmavt: Correct warning during QPN allocation")
      Reviewed-by: default avatarKaike Wan <kaike.wan@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3fe551cc
    • Helge Deller's avatar
      parisc: Fix compiler warnings in float emulation code · 3333e040
      Helge Deller authored
      [ Upstream commit 6b98d913 ]
      
      Avoid such compiler warnings:
      arch/parisc/math-emu/cnv_float.h:71:27: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
           ((Dintp1(dint_valueA) << 33 - SGL_EXP_LENGTH) || Dintp2(dint_valueB))
      arch/parisc/math-emu/fcnvxf.c:257:6: note: in expansion of macro ‘Dint_isinexact_to_sgl’
        if (Dint_isinexact_to_sgl(srcp1,srcp2)) {
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3333e040
    • YueHaibing's avatar
      parport: Fix mem leak in parport_register_dev_model · f9dd0f09
      YueHaibing authored
      [ Upstream commit 1c7ebeab ]
      
      BUG: memory leak
      unreferenced object 0xffff8881df48cda0 (size 16):
        comm "syz-executor.0", pid 5077, jiffies 4295994670 (age 22.280s)
        hex dump (first 16 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000d2d0d5fe>] parport_register_dev_model+0x141/0x6e0 [parport]
          [<00000000782f6dab>] 0xffffffffc15d1196
          [<00000000d2ca6ae4>] platform_drv_probe+0x7e/0x100
          [<00000000628c2a94>] really_probe+0x342/0x4d0
          [<000000006874f5da>] driver_probe_device+0x8c/0x170
          [<00000000424de37a>] __device_attach_driver+0xda/0x100
          [<000000002acab09a>] bus_for_each_drv+0xfe/0x170
          [<000000003d9e5f31>] __device_attach+0x190/0x230
          [<0000000035d32f80>] bus_probe_device+0x123/0x140
          [<00000000a05ba627>] device_add+0x7cc/0xce0
          [<000000003f7560bf>] platform_device_add+0x230/0x3c0
          [<000000002a0be07d>] 0xffffffffc15d0949
          [<000000007361d8d2>] port_check+0x3b/0x50 [parport]
          [<000000004d67200f>] bus_for_each_dev+0x115/0x180
          [<000000003ccfd11c>] __parport_register_driver+0x1f0/0x210 [parport]
          [<00000000987f06fc>] 0xffffffffc15d803e
      
      After commit 4e5a74f1 ("parport: Revert "parport: fix
      memory leak""), free_pardevice do not free par_dev->state,
      we should free it in error path of parport_register_dev_model
      before return.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Fixes: 4e5a74f1 ("parport: Revert "parport: fix memory leak"")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f9dd0f09
    • Scott Wood's avatar
      fpga: dfl: Add lockdep classes for pdata->lock · 4c950c8b
      Scott Wood authored
      [ Upstream commit dfe3de8d ]
      
      struct dfl_feature_platform_data (and it's mutex) is used
      by both fme and port devices, and when lockdep is enabled it
      complains about nesting between these locks.  Tell lockdep about
      the difference so it can track each class separately.
      
      Here's the lockdep complaint:
      [  409.680668] WARNING: possible recursive locking detected
      [  409.685983] 5.1.0-rc3.fpga+ #1 Tainted: G            E
      [  409.691469] --------------------------------------------
      [  409.696779] fpgaconf/9348 is trying to acquire lock:
      [  409.701746] 00000000a443fe2e (&pdata->lock){+.+.}, at: port_enable_set+0x24/0x60 [dfl_afu]
      [  409.710006]
      [  409.710006] but task is already holding lock:
      [  409.715837] 0000000063b78782 (&pdata->lock){+.+.}, at: fme_pr_ioctl+0x21d/0x330 [dfl_fme]
      [  409.724012]
      [  409.724012] other info that might help us debug this:
      [  409.730535]  Possible unsafe locking scenario:
      [  409.730535]
      [  409.736457]        CPU0
      [  409.738910]        ----
      [  409.741360]   lock(&pdata->lock);
      [  409.744679]   lock(&pdata->lock);
      [  409.747999]
      [  409.747999]  *** DEADLOCK ***
      [  409.747999]
      [  409.753920]  May be due to missing lock nesting notation
      [  409.753920]
      [  409.760704] 4 locks held by fpgaconf/9348:
      [  409.764805]  #0: 0000000063b78782 (&pdata->lock){+.+.}, at: fme_pr_ioctl+0x21d/0x330 [dfl_fme]
      [  409.773408]  #1: 00000000213c8a66 (&region->mutex){+.+.}, at: fpga_region_program_fpga+0x24/0x200 [fpga_region]
      [  409.783489]  #2: 00000000fe63afb9 (&mgr->ref_mutex){+.+.}, at: fpga_mgr_lock+0x15/0x40 [fpga_mgr]
      [  409.792354]  #3: 000000000b2285c5 (&bridge->mutex){+.+.}, at: __fpga_bridge_get+0x26/0xa0 [fpga_bridge]
      [  409.801740]
      [  409.801740] stack backtrace:
      [  409.806102] CPU: 45 PID: 9348 Comm: fpgaconf Kdump: loaded Tainted: G            E     5.1.0-rc3.fpga+ #1
      [  409.815658] Hardware name: Intel Corporation S2600BT/S2600BT, BIOS SE5C620.86B.01.00.0763.022420181017 02/24/2018
      [  409.825911] Call Trace:
      [  409.828369]  dump_stack+0x5e/0x8b
      [  409.831686]  __lock_acquire+0xf3d/0x10e0
      [  409.835612]  ? find_held_lock+0x3c/0xa0
      [  409.839451]  lock_acquire+0xbc/0x1d0
      [  409.843030]  ? port_enable_set+0x24/0x60 [dfl_afu]
      [  409.847823]  ? port_enable_set+0x24/0x60 [dfl_afu]
      [  409.852616]  __mutex_lock+0x86/0x970
      [  409.856195]  ? port_enable_set+0x24/0x60 [dfl_afu]
      [  409.860989]  ? port_enable_set+0x24/0x60 [dfl_afu]
      [  409.865777]  ? __mutex_unlock_slowpath+0x4b/0x290
      [  409.870486]  port_enable_set+0x24/0x60 [dfl_afu]
      [  409.875106]  fpga_bridges_disable+0x36/0x50 [fpga_bridge]
      [  409.880502]  fpga_region_program_fpga+0xea/0x200 [fpga_region]
      [  409.886338]  fme_pr_ioctl+0x13e/0x330 [dfl_fme]
      [  409.890870]  fme_ioctl+0x66/0xe0 [dfl_fme]
      [  409.894973]  do_vfs_ioctl+0xa9/0x720
      [  409.898548]  ? lockdep_hardirqs_on+0xf0/0x1a0
      [  409.902907]  ksys_ioctl+0x60/0x90
      [  409.906225]  __x64_sys_ioctl+0x16/0x20
      [  409.909981]  do_syscall_64+0x5a/0x220
      [  409.913644]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
      [  409.918698] RIP: 0033:0x7f9d31b9b8d7
      [  409.922276] Code: 44 00 00 48 8b 05 b9 15 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 89 15 2d 00 f7 d8 64 89 01 48
      [  409.941020] RSP: 002b:00007ffe4cae0d68 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
      [  409.948588] RAX: ffffffffffffffda RBX: 00007f9d32ade6a0 RCX: 00007f9d31b9b8d7
      [  409.955719] RDX: 00007ffe4cae0df0 RSI: 000000000000b680 RDI: 0000000000000003
      [  409.962852] RBP: 0000000000000003 R08: 00007f9d2b70a177 R09: 00007ffe4cae0e40
      [  409.969984] R10: 00007ffe4cae0160 R11: 0000000000000202 R12: 00007ffe4cae0df0
      [  409.977115] R13: 000000000000b680 R14: 0000000000000000 R15: 00007ffe4cae0f60
      Signed-off-by: default avatarScott Wood <swood@redhat.com>
      Acked-by: default avatarWu Hao <hao.wu@intel.com>
      Acked-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4c950c8b
    • Scott Wood's avatar
      fpga: dfl: afu: Pass the correct device to dma_mapping_error() · 505de32e
      Scott Wood authored
      [ Upstream commit 13069847 ]
      
      dma_mapping_error() was being called on a different device struct than
      what was passed to map/unmap.  Besides rendering the error checking
      ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
      Signed-off-by: default avatarScott Wood <swood@redhat.com>
      Acked-by: default avatarWu Hao <hao.wu@intel.com>
      Acked-by: default avatarMoritz Fischer <mdf@kernel.org>
      Acked-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      505de32e
    • Jose Abreu's avatar
      ARC: [plat-hsdk]: Add missing FIFO size entry in GMAC node · 7b2145e2
      Jose Abreu authored
      [ Upstream commit 4c70850a ]
      
      Add the binding for RX/TX fifo size of GMAC node.
      
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Tested-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Acked-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7b2145e2
    • Jose Abreu's avatar
      ARC: [plat-hsdk]: Add missing multicast filter bins number to GMAC node · 15004afd
      Jose Abreu authored
      [ Upstream commit ecc906a1 ]
      
      GMAC controller on HSDK boards supports 256 Hash Table size so we need to
      add the multicast filter bins property. This allows for the Hash filter
      to work properly using stmmac driver.
      
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Acked-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      15004afd
    • Eric Long's avatar
      dmaengine: sprd: Fix block length overflow · 8f3793bf
      Eric Long authored
      [ Upstream commit 89d03b3c ]
      
      The maximum value of block length is 0xffff, so if the configured transfer length
      is more than 0xffff, that will cause block length overflow to lead a configuration
      error.
      
      Thus we can set block length as the maximum burst length to avoid this issue, since
      the maximum burst length will not be a big value which is more than 0xffff.
      Signed-off-by: default avatarEric Long <eric.long@unisoc.com>
      Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8f3793bf
    • Colin Ian King's avatar
      dmaengine: dw-axi-dmac: fix null dereference when pointer first is null · e478abd4
      Colin Ian King authored
      [ Upstream commit 0788611c ]
      
      In the unlikely event that axi_desc_get returns a null desc in the
      very first iteration of the while-loop the error exit path ends
      up calling axi_desc_put on a null pointer 'first' and this causes
      a null pointer dereference.  Fix this by adding a null check on
      pointer 'first' before calling axi_desc_put.
      
      Addresses-Coverity: ("Explicit null dereference")
      Fixes: 1fe20f1b ("dmaengine: Introduce DW AXI DMAC driver")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e478abd4
    • Vineet Gupta's avatar
      ARC: fix build warnings · 4c21b761
      Vineet Gupta authored
      [ Upstream commit 89c92142 ]
      
      | arch/arc/mm/tlb.c:914:2: warning: variable length array 'pd0' is used [-Wvla]
      | arch/arc/include/asm/cmpxchg.h:95:29: warning: value computed is not used [-Wunused-value]
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4c21b761
    • Douglas Anderson's avatar
      brcmfmac: sdio: Don't tune while the card is off · d64f99ef
      Douglas Anderson authored
      commit 65dade60 upstream.
      
      When Broadcom SDIO cards are idled they go to sleep and a whole
      separate subsystem takes over their SDIO communication.  This is the
      Always-On-Subsystem (AOS) and it can't handle tuning requests.
      
      Specifically, as tested on rk3288-veyron-minnie (which reports having
      BCM4354/1 in dmesg), if I force a retune in brcmf_sdio_kso_control()
      when "on = 1" (aka we're transition from sleep to wake) by whacking:
        bus->sdiodev->func1->card->host->need_retune = 1
      ...then I can often see tuning fail.  In this case dw_mmc reports "All
      phases bad!").  Note that I don't get 100% failure, presumably because
      sometimes the card itself has already transitioned away from the AOS
      itself by the time we try to wake it up.  If I force retuning when "on
      = 0" (AKA force retuning right before sending the command to go to
      sleep) then retuning is always OK.
      
      NOTE: we need _both_ this patch and the patch to avoid triggering
      tuning due to CRC errors in the sleep/wake transition, AKA ("brcmfmac:
      sdio: Disable auto-tuning around commands expected to fail").  Though
      both patches handle issues with Broadcom's AOS, the problems are
      distinct:
      1. We want to defer (but not ignore) asynchronous (like
         timer-requested) tuning requests till the card is awake.  However,
         we want to ignore CRC errors during the transition, we don't want
         to queue deferred tuning request.
      2. You could imagine that the AOS could implement retuning but we
         could still get errors while transitioning in and out of the AOS.
         Similarly you could imagine a seamless transition into and out of
         the AOS (with no CRC errors) even if the AOS couldn't handle
         tuning.
      
      ALSO NOTE: presumably there is never a desperate need to retune in
      order to wake up the card, since doing so is impossible.  Luckily the
      only way the card can get into sleep state is if we had a good enough
      tuning to send it the command to put it into sleep, so presumably that
      "good enough" tuning is enough to wake us up, at least with a few
      retries.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d64f99ef
    • Douglas Anderson's avatar
      brcmfmac: sdio: Disable auto-tuning around commands expected to fail · 0ad82f2e
      Douglas Anderson authored
      commit 2de0b42d upstream.
      
      There are certain cases, notably when transitioning between sleep and
      active state, when Broadcom SDIO WiFi cards will produce errors on the
      SDIO bus.  This is evident from the source code where you can see that
      we try commands in a loop until we either get success or we've tried
      too many times.  The comment in the code reinforces this by saying
      "just one write attempt may fail"
      
      Unfortunately these failures sometimes end up causing an "-EILSEQ"
      back to the core which triggers a retuning of the SDIO card and that
      blocks all traffic to the card until it's done.
      
      Let's disable retuning around the commands we expect might fail.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0ad82f2e
    • Jann Horn's avatar
      apparmor: enforce nullbyte at end of tag string · 31c99580
      Jann Horn authored
      commit 8404d7a6 upstream.
      
      A packed AppArmor policy contains null-terminated tag strings that are read
      by unpack_nameX(). However, unpack_nameX() uses string functions on them
      without ensuring that they are actually null-terminated, potentially
      leading to out-of-bounds accesses.
      
      Make sure that the tag string is null-terminated before passing it to
      strcmp().
      
      Cc: stable@vger.kernel.org
      Fixes: 736ec752 ("AppArmor: policy routines for loading and unpacking policy")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31c99580
    • John Johansen's avatar
      apparmor: fix PROFILE_MEDIATES for untrusted input · eb2b0bf5
      John Johansen authored
      commit 23375b13 upstream.
      
      While commit 11c236b8 ("apparmor: add a default null dfa") ensure
      every profile has a policy.dfa it does not resize the policy.start[]
      to have entries for every possible start value. Which means
      PROFILE_MEDIATES is not safe to use on untrusted input. Unforunately
      commit b9590ad4 ("apparmor: remove POLICY_MEDIATES_SAFE") did not
      take into account the start value usage.
      
      The input string in profile_query_cb() is user controlled and is not
      properly checked to be within the limited start[] entries, even worse
      it can't be as userspace policy is allowed to make us of entries types
      the kernel does not know about. This mean usespace can currently cause
      the kernel to access memory up to 240 entries beyond the start array
      bounds.
      
      Cc: stable@vger.kernel.org
      Fixes: b9590ad4 ("apparmor: remove POLICY_MEDIATES_SAFE")
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb2b0bf5
    • Daniel Smith's avatar
      Input: silead - add MSSL0017 to acpi_device_id · 1d08fe25
      Daniel Smith authored
      commit 0e658060 upstream.
      
      On Chuwi Hi10 Plus, the Silead device id is MSSL0017.
      Signed-off-by: default avatarDaniel Smith <danct12@disroot.org>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d08fe25
    • Andrey Smirnov's avatar
      Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD · ebd7dda8
      Andrey Smirnov authored
      commit 7c7da40d upstream.
      
      In the case of compat syscall ioctl numbers for UI_BEGIN_FF_UPLOAD and
      UI_END_FF_UPLOAD need to be adjusted before being passed on
      uinput_ioctl_handler() since code built with -m32 will be passing
      slightly different values. Extend the code already covering
      UI_SET_PHYS to cover UI_BEGIN_FF_UPLOAD and UI_END_FF_UPLOAD as well.
      Reported-by: default avatarPierre-Loup A. Griffais <pgriffais@valvesoftware.com>
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebd7dda8
    • Alexander Mikhaylenko's avatar
      Input: synaptics - enable SMBus on ThinkPad E480 and E580 · 9f3559e4
      Alexander Mikhaylenko authored
      commit 9843f3e0 upstream.
      
      They are capable of using intertouch and it works well with
      psmouse.synaptics_intertouch=1, so add them to the list.
      
      Without it, scrolling and gestures are jumpy, three-finger pinch gesture
      doesn't work and three- or four-finger swipes sometimes get stuck.
      Signed-off-by: default avatarAlexander Mikhaylenko <exalm7659@gmail.com>
      Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f3559e4
    • Crt Mori's avatar
      iio: temperature: mlx90632 Relax the compatibility check · e61e41ff
      Crt Mori authored
      commit 389fc70b upstream.
      
      Register EE_VERSION contains mixture of calibration information and DSP
      version. So far, because calibrations were definite, the driver
      compatibility depended on whole contents, but in the newer production
      process the calibration part changes. Because of that, value in EE_VERSION
      will be changed and to avoid that calibration value is same as DSP version
      the MSB in calibration part was fixed to 1.
      That means existing calibrations (medical and consumer) will now have
      hex values (bits 8 to 15) of 83 and 84 respectively. Driver compatibility
      should be based only on DSP version part of the EE_VERSION (bits 0 to 7)
      register.
      Signed-off-by: default avatarCrt Mori <cmo@melexis.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e61e41ff
    • Mike Marciniszyn's avatar
      IB/hfi1: Silence txreq allocation warnings · 303386b3
      Mike Marciniszyn authored
      commit 3230f4a8 upstream.
      
      The following warning can happen when a memory shortage
      occurs during txreq allocation:
      
      [10220.939246] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
      [10220.939246] Hardware name: Intel Corporation S2600WT2R/S2600WT2R, BIOS SE5C610.86B.01.01.0018.C4.072020161249 07/20/2016
      [10220.939247]   cache: mnt_cache, object size: 384, buffer size: 384, default order: 2, min order: 0
      [10220.939260] Workqueue: hfi0_0 _hfi1_do_send [hfi1]
      [10220.939261]   node 0: slabs: 1026568, objs: 43115856, free: 0
      [10220.939262] Call Trace:
      [10220.939262]   node 1: slabs: 820872, objs: 34476624, free: 0
      [10220.939263]  dump_stack+0x5a/0x73
      [10220.939265]  warn_alloc+0x103/0x190
      [10220.939267]  ? wake_all_kswapds+0x54/0x8b
      [10220.939268]  __alloc_pages_slowpath+0x86c/0xa2e
      [10220.939270]  ? __alloc_pages_nodemask+0x2fe/0x320
      [10220.939271]  __alloc_pages_nodemask+0x2fe/0x320
      [10220.939273]  new_slab+0x475/0x550
      [10220.939275]  ___slab_alloc+0x36c/0x520
      [10220.939287]  ? hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939299]  ? __get_txreq+0x54/0x160 [hfi1]
      [10220.939310]  ? hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939312]  __slab_alloc+0x40/0x61
      [10220.939323]  ? hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939325]  kmem_cache_alloc+0x181/0x1b0
      [10220.939336]  hfi1_make_rc_req+0x90/0x18b0 [hfi1]
      [10220.939348]  ? hfi1_verbs_send_dma+0x386/0xa10 [hfi1]
      [10220.939359]  ? find_prev_entry+0xb0/0xb0 [hfi1]
      [10220.939371]  hfi1_do_send+0x1d9/0x3f0 [hfi1]
      [10220.939372]  process_one_work+0x171/0x380
      [10220.939374]  worker_thread+0x49/0x3f0
      [10220.939375]  kthread+0xf8/0x130
      [10220.939377]  ? max_active_store+0x80/0x80
      [10220.939378]  ? kthread_bind+0x10/0x10
      [10220.939379]  ret_from_fork+0x35/0x40
      [10220.939381] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
      
      The shortage is handled properly so the message isn't needed. Silence by
      adding the no warn option to the slab allocation.
      
      Fixes: 45842abb ("staging/rdma/hfi1: move txreq header code")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      303386b3
    • Kaike Wan's avatar
      IB/hfi1: Validate fault injection opcode user input · 7cc9c993
      Kaike Wan authored
      commit 5f90677e upstream.
      
      The opcode range for fault injection from user should be validated before
      it is applied to the fault->opcodes[] bitmap to avoid out-of-bound
      error.
      
      Cc: <stable@vger.kernel.org>
      Fixes: a74d5307 ("IB/hfi1: Rework fault injection machinery")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarKaike Wan <kaike.wan@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7cc9c993
    • Mathias Nyman's avatar
      usb: xhci: Don't try to recover an endpoint if port is in error state. · 17027034
      Mathias Nyman authored
      commit b8c3b718 upstream.
      
      A USB3 device needs to be reset and re-enumarated if the port it
      connects to goes to a error state, with link state inactive.
      
      There is no use in trying to recover failed transactions by resetting
      endpoints at this stage. Tests show that in rare cases, after multiple
      endpoint resets of a roothub port the whole host controller might stop
      completely.
      
      Several retries to recover from transaction error can happen as
      it can take a long time before the hub thread discovers the USB3
      port error and inactive link.
      
      We can't reliably detect the port error from slot or endpoint context
      due to a limitation in xhci, see xhci specs section 4.8.3:
      "There are several cases where the EP State field in the Output
      Endpoint Context may not reflect the current state of an endpoint"
      and
      "Software should maintain an accurate value for EP State, by tracking it
      with an internal variable that is driven by Events and Doorbell accesses"
      
      Same appears to be true for slot state.
      
      set a flag to the corresponding slot if a USB3 roothub port link goes
      inactive to prevent both queueing new URBs and resetting endpoints.
      Reported-by: default avatarRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Tested-by: default avatarRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17027034
    • Mathias Nyman's avatar
      xhci: detect USB 3.2 capable host controllers correctly · d606a82c
      Mathias Nyman authored
      commit ddd57980 upstream.
      
      USB 3.2 capability in a host can be detected from the
      xHCI Supported Protocol Capability major and minor revision fields.
      
      If major is 0x3 and minor 0x20 then the host is USB 3.2 capable.
      
      For USB 3.2 capable hosts set the root hub lane count to 2.
      
      The Major Revision and Minor Revision fields contain a BCD version number.
      The value of the Major Revision field is JJh and the value of the Minor
      Revision field is MNh for version JJ.M.N, where JJ = major revision number,
      M - minor version number, N = sub-minor version number,
      e.g. version 3.1 is represented with a value of 0310h.
      
      Also fix the extra whitespace printed out when announcing regular
      SuperSpeed hosts.
      
      Cc: <stable@vger.kernel.org> # v4.18+
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d606a82c
    • Peter Chen's avatar
      usb: chipidea: udc: workaround for endpoint conflict issue · e6563039
      Peter Chen authored
      commit c19dffc0 upstream.
      
      An endpoint conflict occurs when the USB is working in device mode
      during an isochronous communication. When the endpointA IN direction
      is an isochronous IN endpoint, and the host sends an IN token to
      endpointA on another device, then the OUT transaction may be missed
      regardless the OUT endpoint number. Generally, this occurs when the
      device is connected to the host through a hub and other devices are
      connected to the same hub.
      
      The affected OUT endpoint can be either control, bulk, isochronous, or
      an interrupt endpoint. After the OUT endpoint is primed, if an IN token
      to the same endpoint number on another device is received, then the OUT
      endpoint may be unprimed (cannot be detected by software), which causes
      this endpoint to no longer respond to the host OUT token, and thus, no
      corresponding interrupt occurs.
      
      There is no good workaround for this issue, the only thing the software
      could do is numbering isochronous IN from the highest endpoint since we
      have observed most of device number endpoint from the lowest.
      
      Cc: <stable@vger.kernel.org> #v3.14+
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Cc: Jun Li <jun.li@nxp.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6563039
    • Stanley Chu's avatar
      scsi: ufs: Avoid runtime suspend possibly being blocked forever · 0746b2f5
      Stanley Chu authored
      commit 24e2e7a1 upstream.
      
      UFS runtime suspend can be triggered after pm_runtime_enable() is invoked
      in ufshcd_pltfrm_init(). However if the first runtime suspend is triggered
      before binding ufs_hba structure to ufs device structure via
      platform_set_drvdata(), then UFS runtime suspend will be no longer
      triggered in the future because its dev->power.runtime_error was set in the
      first triggering and does not have any chance to be cleared.
      
      To be more clear, dev->power.runtime_error is set if hba is NULL in
      ufshcd_runtime_suspend() which returns -EINVAL to rpm_callback() where
      dev->power.runtime_error is set as -EINVAL. In this case, any future
      rpm_suspend() for UFS device fails because rpm_check_suspend_allowed()
      fails due to non-zero
      dev->power.runtime_error.
      
      To resolve this issue, make sure the first UFS runtime suspend get valid
      "hba" in ufshcd_runtime_suspend(): Enable UFS runtime PM only after hba is
      successfully bound to UFS device structure.
      
      Fixes: 62694735 ([SCSI] ufs: Add runtime PM support for UFS host controller driver)
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
      Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0746b2f5
    • Ulf Hansson's avatar
      mmc: core: Prevent processing SDIO IRQs when the card is suspended · 98467b8f
      Ulf Hansson authored
      commit 83293386 upstream.
      
      Processing of SDIO IRQs must obviously be prevented while the card is
      system suspended, otherwise we may end up trying to communicate with an
      uninitialized SDIO card.
      
      Reports throughout the years shows that this is not only a theoretical
      problem, but a real issue. So, let's finally fix this problem, by keeping
      track of the state for the card and bail out before processing the SDIO
      IRQ, in case the card is suspended.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDouglas Anderson <dianders@chromium.org>
      Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98467b8f
    • Douglas Anderson's avatar
      mmc: core: Add sdio_retune_hold_now() and sdio_retune_release() · 0349dbeb
      Douglas Anderson authored
      commit b4c9f938 upstream.
      
      We want SDIO drivers to be able to temporarily stop retuning when the
      driver knows that the SDIO card is not in a state where retuning will
      work (maybe because the card is asleep).  We'll move the relevant
      functions to a place where drivers can call them.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0349dbeb
    • Douglas Anderson's avatar
      mmc: core: API to temporarily disable retuning for SDIO CRC errors · 7ed49e1b
      Douglas Anderson authored
      commit 0a55f4ab upstream.
      
      Normally when the MMC core sees an "-EILSEQ" error returned by a host
      controller then it will trigger a retuning of the card.  This is
      generally a good idea.
      
      However, if a command is expected to sometimes cause transfer errors
      then these transfer errors shouldn't cause a re-tuning.  This
      re-tuning will be a needless waste of time.  One example case where a
      transfer is expected to cause errors is when transitioning between
      idle (sometimes referred to as "sleep" in Broadcom code) and active
      state on certain Broadcom WiFi SDIO cards.  Specifically if the card
      was already transitioning between states when the command was sent it
      could cause an error on the SDIO bus.
      
      Let's add an API that the SDIO function drivers can call that will
      temporarily disable the auto-tuning functionality.  Then we can add a
      call to this in the Broadcom WiFi driver and any other driver that
      might have similar needs.
      
      NOTE: this makes the assumption that the card is already tuned well
      enough that it's OK to disable the auto-retuning during one of these
      error-prone situations.  Presumably the driver code performing the
      error-prone transfer knows how to recover / retry from errors.  ...and
      after we can get back to a state where transfers are no longer
      error-prone then we can enable the auto-retuning again.  If we truly
      find ourselves in a case where the card needs to be retuned sometimes
      to handle one of these error-prone transfers then we can always try a
      few transfers first without auto-retuning and then re-try with
      auto-retuning if the first few fail.
      
      Without this change on rk3288-veyron-minnie I periodically see this in
      the logs of a machine just sitting there idle:
        dwmmc_rockchip ff0d0000.dwmmc: Successfully tuned phase to XYZ
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ed49e1b
    • Raul E Rangel's avatar
      mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning · 4b6d290c
      Raul E Rangel authored
      commit 0f7b79a4 upstream.
      
      The O2Micro controller only supports tuning at 4-bits. So the host driver
      needs to change the bus width while tuning and then set it back when done.
      
      There was a bug in the original implementation in that mmc->ios.bus_width
      also wasn't updated. Thus setting the incorrect blocksize in
      sdhci_send_tuning which results in a tuning failure.
      Signed-off-by: default avatarRaul E Rangel <rrangel@chromium.org>
      Fixes: 0086fc21 ("mmc: sdhci: Add support for O2 hardware tuning")
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b6d290c
    • Harald Freudenberger's avatar
      s390/ap: rework assembler functions to use unions for in/out register variables · 4c15ded5
      Harald Freudenberger authored
      [ Upstream commit 159491f3 ]
      
      The inline assembler functions ap_aqic() and ap_qact() used two
      variables declared on the very same register. One variable was for
      input only, the other for output. Looks like newer versions of the gcc
      don't like this. Anyway it is a better coding to use one variable
      (which may have a union data type) on one register for input and
      output. So this patch introduces unions and uses only one variable now
      for input and output for GR1 for the PQAP(QACT) and PQAP(QIC)
      invocation.
      Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4c15ded5
    • Ilya Leoshkevich's avatar
      s390/jump_label: Use "jdd" constraint on gcc9 · fb48fb15
      Ilya Leoshkevich authored
      [ Upstream commit 14644852 ]
      
      [heiko.carstens@de.ibm.com]:
      -----
      Laura Abbott reported that the kernel doesn't build anymore with gcc 9,
      due to the "X" constraint. Ilya provided the gcc 9 patch "S/390:
      Introduce jdd constraint" which introduces the new "jdd" constraint
      which fixes this.
      -----
      
      The support for section anchors on S/390 introduced in gcc9 has changed
      the behavior of "X" constraint, which can now produce register
      references. Since existing constraints, in particular, "i", do not fit
      the intended use case on S/390, the new machine-specific "jdd"
      constraint was introduced. This patch makes jump labels use "jdd"
      constraint when building with gcc9.
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fb48fb15
    • Arnd Bergmann's avatar
      ovl: fix bogus -Wmaybe-unitialized warning · 0319ef1d
      Arnd Bergmann authored
      [ Upstream commit 1dac6f5b ]
      
      gcc gets a bit confused by the logic in ovl_setup_trap() and
      can't figure out whether the local 'trap' variable in the caller
      was initialized or not:
      
      fs/overlayfs/super.c: In function 'ovl_fill_super':
      fs/overlayfs/super.c:1333:4: error: 'trap' may be used uninitialized in this function [-Werror=maybe-uninitialized]
          iput(trap);
          ^~~~~~~~~~
      fs/overlayfs/super.c:1312:17: note: 'trap' was declared here
      
      Reword slightly to make it easier for the compiler to understand.
      
      Fixes: 146d62e5 ("ovl: detect overlapping layers")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0319ef1d
    • Miklos Szeredi's avatar
      ovl: don't fail with disconnected lower NFS · 639e8c2f
      Miklos Szeredi authored
      [ Upstream commit 9179c21d ]
      
      NFS mounts can be disconnected from fs root.  Don't fail the overlapping
      layer check because of this.
      
      The check is not authoritative anyway, since topology can change during or
      after the check.
      Reported-by: default avatarAntti Antinoja <antti@fennosys.fi>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Fixes: 146d62e5 ("ovl: detect overlapping layers")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      639e8c2f
    • Amir Goldstein's avatar
      ovl: detect overlapping layers · f1c5aa5e
      Amir Goldstein authored
      [ Upstream commit 146d62e5 ]
      
      Overlapping overlay layers are not supported and can cause unexpected
      behavior, but overlayfs does not currently check or warn about these
      configurations.
      
      User is not supposed to specify the same directory for upper and
      lower dirs or for different lower layers and user is not supposed to
      specify directories that are descendants of each other for overlay
      layers, but that is exactly what this zysbot repro did:
      
          https://syzkaller.appspot.com/x/repro.syz?x=12c7a94f400000
      
      Moving layer root directories into other layers while overlayfs
      is mounted could also result in unexpected behavior.
      
      This commit places "traps" in the overlay inode hash table.
      Those traps are dummy overlay inodes that are hashed by the layers
      root inodes.
      
      On mount, the hash table trap entries are used to verify that overlay
      layers are not overlapping.  While at it, we also verify that overlay
      layers are not overlapping with directories "in-use" by other overlay
      instances as upperdir/workdir.
      
      On lookup, the trap entries are used to verify that overlay layers
      root inodes have not been moved into other layers after mount.
      
      Some examples:
      
      $ ./run --ov --samefs -s
      ...
      ( mkdir -p base/upper/0/u base/upper/0/w base/lower lower upper mnt
        mount -o bind base/lower lower
        mount -o bind base/upper upper
        mount -t overlay none mnt ...
              -o lowerdir=lower,upperdir=upper/0/u,workdir=upper/0/w)
      
      $ umount mnt
      $ mount -t overlay none mnt ...
              -o lowerdir=base,upperdir=upper/0/u,workdir=upper/0/w
      
        [   94.434900] overlayfs: overlapping upperdir path
        mount: mount overlay on mnt failed: Too many levels of symbolic links
      
      $ mount -t overlay none mnt ...
              -o lowerdir=upper/0/u,upperdir=upper/0/u,workdir=upper/0/w
      
        [  151.350132] overlayfs: conflicting lowerdir path
        mount: none is already mounted or mnt busy
      
      $ mount -t overlay none mnt ...
              -o lowerdir=lower:lower/a,upperdir=upper/0/u,workdir=upper/0/w
      
        [  201.205045] overlayfs: overlapping lowerdir path
        mount: mount overlay on mnt failed: Too many levels of symbolic links
      
      $ mount -t overlay none mnt ...
              -o lowerdir=lower,upperdir=upper/0/u,workdir=upper/0/w
      $ mv base/upper/0/ base/lower/
      $ find mnt/0
        mnt/0
        mnt/0/w
        find: 'mnt/0/w/work': Too many levels of symbolic links
        find: 'mnt/0/u': Too many levels of symbolic links
      
      Reported-by: syzbot+9c69c282adc4edd2b540@syzkaller.appspotmail.com
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f1c5aa5e
    • Amir Goldstein's avatar
      ovl: make i_ino consistent with st_ino in more cases · a00f405e
      Amir Goldstein authored
      [ Upstream commit 6dde1e42 ]
      
      Relax the condition that overlayfs supports nfs export, to require
      that i_ino is consistent with st_ino/d_ino.
      
      It is enough to require that st_ino and d_ino are consistent.
      
      This fixes the failure of xfstest generic/504, due to mismatch of
      st_ino to inode number in the output of /proc/locks.
      
      Fixes: 12574a9f ("ovl: consistent i_ino for non-samefs with xino")
      Cc: <stable@vger.kernel.org> # v4.19
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a00f405e
    • Amir Goldstein's avatar
      ovl: fix wrong flags check in FS_IOC_FS[SG]ETXATTR ioctls · d6623379
      Amir Goldstein authored
      [ Upstream commit 941d935a ]
      
      The ioctl argument was parsed as the wrong type.
      
      Fixes: b21d9c43 ("ovl: support the FS_IOC_FS[SG]ETXATTR ioctls")
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d6623379
    • Amir Goldstein's avatar
      ovl: support the FS_IOC_FS[SG]ETXATTR ioctls · 3cb5d7fa
      Amir Goldstein authored
      [ Upstream commit b21d9c43 ]
      
      They are the extended version of FS_IOC_FS[SG]ETFLAGS ioctls.
      xfs_io -c "chattr <flags>" uses the new ioctls for setting flags.
      
      This used to work in kernel pre v4.19, before stacked file ops
      introduced the ovl_ioctl whitelist.
      Reported-by: default avatarDave Chinner <david@fromorbit.com>
      Fixes: d1d04ef8 ("ovl: stack file ops")
      Cc: <stable@vger.kernel.org> # v4.19
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3cb5d7fa
    • Linus Torvalds's avatar
      gcc-9: silence 'address-of-packed-member' warning · 76343a13
      Linus Torvalds authored
      commit 6f303d60 upstream.
      
      We already did this for clang, but now gcc has that warning too.  Yes,
      yes, the address may be unaligned.  And that's kind of the point.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76343a13
    • Allan Xavier's avatar
      objtool: Support per-function rodata sections · 6a997c3a
      Allan Xavier authored
      commit 4a60aa05 upstream.
      
      Add support for processing switch jump tables in objects with multiple
      .rodata sections, such as those created by '-ffunction-sections' and
      '-fdata-sections'.  Currently, objtool always looks in .rodata for jump
      table information, which results in many "sibling call from callable
      instruction with modified stack frame" warnings with objects compiled
      using those flags.
      
      The fix is comprised of three parts:
      
      1. Flagging all .rodata sections when importing ELF information for
         easier checking later.
      
      2. Keeping a reference to the section each relocation is from in order
         to get the list_head for the other relocations in that section.
      
      3. Finding jump tables by following relocations to .rodata sections,
         rather than always referencing a single global .rodata section.
      
      The patch has been tested without data sections enabled and no
      differences in the resulting orc unwind information were seen.
      
      Note that as objtool adds terminators to end of each .text section the
      unwind information generated between a function+data sections build and
      a normal build aren't directly comparable. Manual inspection suggests
      that objtool is now generating the correct information, or at least
      making more of an effort to do so than it did previously.
      Signed-off-by: default avatarAllan Xavier <allan.x.xavier@oracle.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/099bdc375195c490dda04db777ee0b95d566ded1.1536325914.git.jpoimboe@redhat.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a997c3a
    • Miguel Ojeda's avatar
      tracing: Silence GCC 9 array bounds warning · c493ead3
      Miguel Ojeda authored
      commit 0c97bf86 upstream.
      
      Starting with GCC 9, -Warray-bounds detects cases when memset is called
      starting on a member of a struct but the size to be cleared ends up
      writing over further members.
      
      Such a call happens in the trace code to clear, at once, all members
      after and including `seq` on struct trace_iterator:
      
          In function 'memset',
              inlined from 'ftrace_dump' at kernel/trace/trace.c:8914:3:
          ./include/linux/string.h:344:9: warning: '__builtin_memset' offset
          [8505, 8560] from the object at 'iter' is out of the bounds of
          referenced subobject 'seq' with type 'struct trace_seq' at offset
          4368 [-Warray-bounds]
            344 |  return __builtin_memset(p, c, size);
                |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      In order to avoid GCC complaining about it, we compute the address
      ourselves by adding the offsetof distance instead of referring
      directly to the member.
      
      Since there are two places doing this clear (trace.c and trace_kdb.c),
      take the chance to move the workaround into a single place in
      the internal header.
      
      Link: http://lkml.kernel.org/r/20190523124535.GA12931@gmail.comSigned-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      [ Removed unnecessary parenthesis around "iter" ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c493ead3
  2. 22 Jun, 2019 1 commit