1. 05 Oct, 2019 40 commits
    • Yazen Ghannam's avatar
      EDAC/amd64: Recognize DRAM device type ECC capability · 6f80e91a
      Yazen Ghannam authored
      [ Upstream commit f8be8e56 ]
      
      AMD Family 17h systems support x4 and x16 DRAM devices. However, the
      device type is not checked when setting mci.edac_ctl_cap.
      
      Set the appropriate capability flag based on the device type.
      
      Default to x8 DRAM device when neither the x4 or x16 bits are set.
      
       [ bp: reverse cpk_en check to save an indentation level. ]
      
      Fixes: 2d09d8f3 ("EDAC, amd64: Determine EDAC MC capabilities on Fam17h")
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
      Cc: James Morse <james.morse@arm.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Link: https://lkml.kernel.org/r/20190821235938.118710-3-Yazen.Ghannam@amd.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      6f80e91a
    • Gerald BAEZA's avatar
      libperf: Fix alignment trap with xyarray contents in 'perf stat' · adb97f18
      Gerald BAEZA authored
      [ Upstream commit d9c5c083 ]
      
      Following the patch 'perf stat: Fix --no-scale', an alignment trap
      happens in process_counter_values() on ARMv7 platforms due to the
      attempt to copy non 64 bits aligned double words (pointed by 'count')
      via a NEON vectored instruction ('vld1' with 64 bits alignment
      constraint).
      
      This patch sets a 64 bits alignment constraint on 'contents[]' field in
      'struct xyarray' since the 'count' pointer used above points to such a
      structure.
      Signed-off-by: default avatarGerald Baeza <gerald.baeza@st.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1566464769-16374-1-git-send-email-gerald.baeza@st.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      adb97f18
    • Wenwen Wang's avatar
      media: dvb-core: fix a memory leak bug · 4df2427a
      Wenwen Wang authored
      [ Upstream commit fcd5ce4b ]
      
      In dvb_create_media_entity(), 'dvbdev->entity' is allocated through
      kzalloc(). Then, 'dvbdev->pads' is allocated through kcalloc(). However, if
      kcalloc() fails, the allocated 'dvbdev->entity' is not deallocated, leading
      to a memory leak bug. To fix this issue, free 'dvbdev->entity' before
      returning -ENOMEM.
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4df2427a
    • Thomas Gleixner's avatar
      posix-cpu-timers: Sanitize bogus WARNONS · 8d5fccff
      Thomas Gleixner authored
      [ Upstream commit 692117c1 ]
      
      Warning when p == NULL and then proceeding and dereferencing p does not
      make any sense as the kernel will crash with a NULL pointer dereference
      right away.
      
      Bailing out when p == NULL and returning an error code does not cure the
      underlying problem which caused p to be NULL. Though it might allow to
      do proper debugging.
      
      Same applies to the clock id check in set_process_cpu_timer().
      
      Clean them up and make them return without trying to do further damage.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
      Link: https://lkml.kernel.org/r/20190819143801.846497772@linutronix.deSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      8d5fccff
    • Sean Young's avatar
      media: dvb-frontends: use ida for pll number · 9df9652b
      Sean Young authored
      [ Upstream commit c268e7ad ]
      
      KASAN: global-out-of-bounds Read in dvb_pll_attach
      
      Syzbot reported global-out-of-bounds Read in dvb_pll_attach, while
      accessing id[dvb_pll_devcount], because dvb_pll_devcount was 65,
      that is more than size of 'id' which is DVB_PLL_MAX(64).
      
      Rather than increasing dvb_pll_devcount every time, use ida so that
      numbers are allocated correctly. This does mean that no more than
      64 devices can be attached at the same time, but this is more than
      sufficient.
      
      usb 1-1: dvb_usb_v2: will pass the complete MPEG2 transport stream to the
      software demuxer
      dvbdev: DVB: registering new adapter (774 Friio White ISDB-T USB2.0)
      usb 1-1: media controller created
      dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
      tc90522 0-0018: Toshiba TC90522 attached.
      usb 1-1: DVB: registering adapter 0 frontend 0 (Toshiba TC90522 ISDB-T
      module)...
      dvbdev: dvb_create_media_entity: media entity 'Toshiba TC90522 ISDB-T
      module' registered.
      ==================================================================
      BUG: KASAN: global-out-of-bounds in dvb_pll_attach+0x6c5/0x830
      drivers/media/dvb-frontends/dvb-pll.c:798
      Read of size 4 at addr ffffffff89c9e5e0 by task kworker/0:1/12
      
      CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.2.0-rc6+ #13
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Workqueue: usb_hub_wq hub_event
      Call Trace:
        __dump_stack lib/dump_stack.c:77 [inline]
        dump_stack+0xca/0x13e lib/dump_stack.c:113
        print_address_description+0x67/0x231 mm/kasan/report.c:188
        __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:317
        kasan_report+0xe/0x20 mm/kasan/common.c:614
        dvb_pll_attach+0x6c5/0x830 drivers/media/dvb-frontends/dvb-pll.c:798
        dvb_pll_probe+0xfe/0x174 drivers/media/dvb-frontends/dvb-pll.c:877
        i2c_device_probe+0x790/0xaa0 drivers/i2c/i2c-core-base.c:389
        really_probe+0x281/0x660 drivers/base/dd.c:509
        driver_probe_device+0x104/0x210 drivers/base/dd.c:670
        __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
        bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454
        __device_attach+0x217/0x360 drivers/base/dd.c:843
        bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
        device_add+0xae6/0x16f0 drivers/base/core.c:2111
        i2c_new_client_device+0x5b3/0xc40 drivers/i2c/i2c-core-base.c:778
        i2c_new_device+0x19/0x50 drivers/i2c/i2c-core-base.c:821
        dvb_module_probe+0xf9/0x220 drivers/media/dvb-core/dvbdev.c:985
        friio_tuner_attach+0x125/0x1d0 drivers/media/usb/dvb-usb-v2/gl861.c:536
        dvb_usbv2_adapter_frontend_init
      drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:675 [inline]
        dvb_usbv2_adapter_init drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:804
      [inline]
        dvb_usbv2_init drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:865 [inline]
        dvb_usbv2_probe.cold+0x24dc/0x255d
      drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:980
        usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
        really_probe+0x281/0x660 drivers/base/dd.c:509
        driver_probe_device+0x104/0x210 drivers/base/dd.c:670
        __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
        bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454
        __device_attach+0x217/0x360 drivers/base/dd.c:843
        bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
        device_add+0xae6/0x16f0 drivers/base/core.c:2111
        usb_set_configuration+0xdf6/0x1670 drivers/usb/core/message.c:2023
        generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210
        usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266
        really_probe+0x281/0x660 drivers/base/dd.c:509
        driver_probe_device+0x104/0x210 drivers/base/dd.c:670
        __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:777
        bus_for_each_drv+0x15c/0x1e0 drivers/base/bus.c:454
        __device_attach+0x217/0x360 drivers/base/dd.c:843
        bus_probe_device+0x1e4/0x290 drivers/base/bus.c:514
        device_add+0xae6/0x16f0 drivers/base/core.c:2111
        usb_new_device.cold+0x8c1/0x1016 drivers/usb/core/hub.c:2534
        hub_port_connect drivers/usb/core/hub.c:5089 [inline]
        hub_port_connect_change drivers/usb/core/hub.c:5204 [inline]
        port_event drivers/usb/core/hub.c:5350 [inline]
        hub_event+0x1ada/0x3590 drivers/usb/core/hub.c:5432
        process_one_work+0x905/0x1570 kernel/workqueue.c:2269
        process_scheduled_works kernel/workqueue.c:2331 [inline]
        worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
        kthread+0x30b/0x410 kernel/kthread.c:255
        ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
      
      The buggy address belongs to the variable:
        id+0x100/0x120
      
      Memory state around the buggy address:
        ffffffff89c9e480: fa fa fa fa 00 00 fa fa fa fa fa fa 00 00 00 00
        ffffffff89c9e500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      > ffffffff89c9e580: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
                                                              ^
        ffffffff89c9e600: 04 fa fa fa fa fa fa fa 04 fa fa fa fa fa fa fa
        ffffffff89c9e680: 04 fa fa fa fa fa fa fa 04 fa fa fa fa fa fa fa
      ==================================================================
      
      Reported-by: syzbot+8a8f48672560c8ca59dd@syzkaller.appspotmail.com
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9df9652b
    • A Sun's avatar
      media: mceusb: fix (eliminate) TX IR signal length limit · 006a6065
      A Sun authored
      [ Upstream commit 9fc3ce31 ]
      
      Fix and eliminate mceusb's IR length limit for IR signals transmitted to
      the MCE IR blaster ports.
      
      An IR signal TX exceeding 306 pulse/space samples presently causes -EINVAL
      return error. There's no such limitation nor error with the MCE device
      hardware. And valid IR signals exist with more than 400 pulse/space for the
      control of certain appliances (eg Panasonic ACXA75C00600 air conditioner).
      
      The scope of this patch is limited to the mceusb driver. There are still
      IR signal TX length and time constraints that related modules of rc core
      (eg LIRC) impose, further up the driver stack.
      
      Changes for mceusb_tx_ir():
      
      Converts and sends LIRC IR pulse/space sequence to MCE device IR
      pulse/space format.
      
      Break long length LIRC sequence into multiple (unlimited number of) parts
      for sending to the MCE device.
      Reduce kernel stack IR buffer size: 128 (was 384)
      Increase MCE IR data packet size: 31 (was 5)
      Zero time LIRC pulse/space no longer copied to MCE IR data.
      Eliminate overwriting the source/input LIRC IR data in txbuf[].
      Eliminate -EINVAL return; return number of IR samples sent (>0) or
      MCE write error code (<0).
      
      New mce_write() and mce_write_callback():
      
      Implements synchronous blocking I/O, with timeout, for writing/sending
      data to the MCE device.
      
      An unlimited multipart IR signal sent to the MCE device faster than real
      time requires flow control absent with the original mce_request_packet()
      and mce_async_callback() asynchronous I/O implementation. Also absent is
      TX error feedback.
      
      mce_write() combines and replaces mce_request_packet() and
      mce_async_callback() with conversion to synchronous I/O.
      mce_write() returns bytes sent (>0) or MCE device write error (<0).
      Debug hex dump TX data before processing.
      
      Rename mce_async_out() -> mce_command_out():
      
      The original name is misleading with underlying synchronous I/O
      implementation. Function renamed to mce_command_out().
      
      Changes in mceusb_handle_command():
      
      Add support for MCE device error case MCE_RSP_TX_TIMEOUT
      "IR TX timeout (TX buffer underrun)"
      
      Changes in mceusb_dev_printdata():
      
      Changes support test and debug of multipart TX IR.
      
      Add buffer boundary information (offset and buffer size) to TX hex dump.
      Correct TX trace bug "Raw IR data, 0 pulse/space samples"
      Add trace for MCE_RSP_TX_TIMEOUT "IR TX timeout (TX buffer underrun)"
      
      Other changes:
      
      The driver's write to USB device architecture change (async to sync I/O)
      is significant so we bump DRIVER_VERSION to "1.95" (from "1.94").
      
      Tests:
      
      $ cat -n irdata1 | head -3
           1  carrier 36000
           2  pulse 6350
           3  space 6350
      $ cat -n irdata1 | tail -3
          76  pulse 6350
          77  space 6350
          78  pulse 6350
      $ ir-ctl -s irdata1
      
      [1549021.073612] mceusb 1-1.3:1.0: requesting 36000 HZ carrier
      [1549021.073635] mceusb 1-1.3:1.0: tx data[0]: 9f 06 01 45 (len=4 sz=4)
      [1549021.073649] mceusb 1-1.3:1.0: Request carrier of 35714 Hz (period 28us)
      [1549021.073848] mceusb 1-1.3:1.0: tx done status = 4 (wait = 100, expire = 100 (1000ms), urb->actual_length = 4, urb->status = 0)
      [1549021.074689] mceusb 1-1.3:1.0: rx data[0]: 9f 06 01 45 (len=4 sz=4)
      [1549021.074701] mceusb 1-1.3:1.0: Got carrier of 35714 Hz (period 28us)
      [1549021.102023] mceusb 1-1.3:1.0: tx data[0]: 9f 08 03 (len=3 sz=3)
      [1549021.102036] mceusb 1-1.3:1.0: Request transmit blaster mask of 0x03
      [1549021.102219] mceusb 1-1.3:1.0: tx done status = 3 (wait = 100, expire = 100 (1000ms), urb->actual_length = 3, urb->status = 0)
      [1549021.131979] mceusb 1-1.3:1.0: tx data[0]: 9e ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f 9e ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f 91 ff (len=81 sz=81)
      [1549021.131992] mceusb 1-1.3:1.0: Raw IR data, 30 pulse/space samples
      [1549021.133592] mceusb 1-1.3:1.0: tx done status = 81 (wait = 100, expire = 100 (1000ms), urb->actual_length = 81, urb->status = 0)
      
      Hex dumps limited to 64 bytes.
      0xff is MCE maximum time pulse, 0x7f is MCE maximum time space.
      
      $ cat -n irdata2 | head -3
           1  carrier 36000
           2  pulse 50
           3  space 50
      $ cat -n irdata2 | tail -3
         254  pulse 50
         255  space 50
         256  pulse 50
      $ ir-ctl -s irdata2
      
      [1549306.586998] mceusb 1-1.3:1.0: tx data[0]: 9f 08 03 (len=3 sz=3)
      [1549306.587015] mceusb 1-1.3:1.0: Request transmit blaster mask of 0x03
      [1549306.587252] mceusb 1-1.3:1.0: tx done status = 3 (wait = 100, expire = 100 (1000ms), urb->actual_length = 3, urb->status = 0)
      [1549306.613275] mceusb 1-1.3:1.0: tx data[0]: 9e 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 9e 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 9e 81 (len=128 sz=128)
      [1549306.613291] mceusb 1-1.3:1.0: Raw IR data, 30 pulse/space samples
      [1549306.614837] mceusb 1-1.3:1.0: tx done status = 128 (wait = 100, expire = 100 (1000ms), urb->actual_length = 128, urb->status = 0)
      [1549306.614861] mceusb 1-1.3:1.0: tx data[0]: 9e 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 9e 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 01 81 9e 01 (len=128 sz=128)
      [1549306.614869] mceusb 1-1.3:1.0: Raw IR data, 30 pulse/space samples
      [1549306.620199] mceusb 1-1.3:1.0: tx done status = 128 (wait = 100, expire = 100 (1000ms), urb->actual_length = 128, urb->status = 0)
      [1549306.620212] mceusb 1-1.3:1.0: tx data[0]: 89 81 01 81 01 81 01 81 01 81 80 (len=11 sz=11)
      [1549306.620221] mceusb 1-1.3:1.0: Raw IR data, 9 pulse/space samples
      [1549306.633294] mceusb 1-1.3:1.0: tx done status = 11 (wait = 98, expire = 100 (1000ms), urb->actual_length = 11, urb->status = 0)
      
      Hex dumps limited to 64 bytes.
      0x81 is MCE minimum time pulse, 0x01 is MCE minimum time space.
      TX IR part 3 sz=11 shows 20msec I/O blocking delay
      (100expire - 98wait = 2jiffies)
      Signed-off-by: default avatarA Sun <as1033x@comcast.net>
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      006a6065
    • Mike Christie's avatar
      nbd: add missing config put · d093d318
      Mike Christie authored
      [ Upstream commit 887e975c ]
      
      Fix bug added with the patch:
      
      commit 8f3ea359
      Author: Josef Bacik <josef@toxicpanda.com>
      Date:   Mon Jul 16 12:11:35 2018 -0400
      
          nbd: handle unexpected replies better
      
      where if the timeout handler runs when the completion path is and we fail
      to grab the mutex in the timeout handler we will leave a config reference
      and cannot free the config later.
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarMike Christie <mchristi@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d093d318
    • Wenwen Wang's avatar
      led: triggers: Fix a memory leak bug · e497ec26
      Wenwen Wang authored
      [ Upstream commit 60e2dde1 ]
      
      In led_trigger_set(), 'event' is allocated in kasprintf(). However, it is
      not deallocated in the following execution if the label 'err_activate' or
      'err_add_groups' is entered, leading to memory leaks. To fix this issue,
      free 'event' before returning the error.
      
      Fixes: 52c47742 ("leds: triggers: send uevent when changing triggers")
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Signed-off-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e497ec26
    • Maxime Ripard's avatar
      ASoC: sun4i-i2s: Don't use the oversample to calculate BCLK · 83c2a42b
      Maxime Ripard authored
      [ Upstream commit 7df8f9a2 ]
      
      The BCLK divider should be calculated using the parameters that actually
      make the BCLK rate: the number of channels, the sampling rate and the
      sample width.
      
      We've been using the oversample_rate previously because in the former SoCs,
      the BCLK's parent is MCLK, which in turn is being used to generate the
      oversample rate, so we end up with something like this:
      
      oversample = mclk_rate / sampling_rate
      bclk_div = oversample / word_size / channels
      
      So, bclk_div = mclk_rate / sampling_rate / word_size / channels.
      
      And this is actually better, since the oversampling ratio only plays a role
      because the MCLK is its parent, not because of what BCLK is supposed to be.
      
      Furthermore, that assumption of MCLK being the parent has been broken on
      newer SoCs, so let's use the proper formula, and have the parent rate as an
      argument.
      
      Fixes: 7d299381 ("ASoC: sun4i-i2s: Add support for H3")
      Fixes: 21faaea1 ("ASoC: sun4i-i2s: Add support for A83T")
      Fixes: 66ecce33 ("ASoC: sun4i-i2s: Add compatibility with A64 codec I2S")
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
      Link: https://lore.kernel.org/r/c3595e3a9788c2ef2dcc30aa3c8c4953bb5cc249.1566242458.git-series.maxime.ripard@bootlin.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      83c2a42b
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Fixup bitsperlong per arch includes · 5466c30b
      Arnaldo Carvalho de Melo authored
      [ Upstream commit 42fc2e9e ]
      
      We were getting the file by luck, from one of the paths in -I, fix it to
      get it from the proper place:
      
        $ cd tools/include/uapi/asm/
        [acme@quaco asm]$ grep include bitsperlong.h
        #include "../../arch/x86/include/uapi/asm/bitsperlong.h"
        #include "../../arch/arm64/include/uapi/asm/bitsperlong.h"
        #include "../../arch/powerpc/include/uapi/asm/bitsperlong.h"
        #include "../../arch/s390/include/uapi/asm/bitsperlong.h"
        #include "../../arch/sparc/include/uapi/asm/bitsperlong.h"
        #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
        #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
        #include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
        #include "../../arch/alpha/include/uapi/asm/bitsperlong.h"
        #include <asm-generic/bitsperlong.h>
        $ ls -la ../../arch/x86/include/uapi/asm/bitsperlong.h
        ls: cannot access '../../arch/x86/include/uapi/asm/bitsperlong.h': No such file or directory
        $ ls -la ../../../arch/*/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 237 ../../../arch/alpha/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 841 ../../../arch/arm64/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 966 ../../../arch/hexagon/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 234 ../../../arch/ia64/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 100 ../../../arch/microblaze/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 244 ../../../arch/mips/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 352 ../../../arch/parisc/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 312 ../../../arch/powerpc/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 353 ../../../arch/riscv/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 292 ../../../arch/s390/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 323 ../../../arch/sparc/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 320 ../../../arch/x86/include/uapi/asm/bitsperlong.h
        $
      
      Found while fixing some other problem, before it was escaping the
      tools/ chroot and using stuff in the kernel sources:
      
          CC       /tmp/build/perf/util/find_bit.o
      In file included from /git/linux/tools/include/../../arch/x86/include/uapi/asm/bitsperlong.h:11,
                       from /git/linux/tools/include/uapi/asm/bitsperlong.h:3,
                       from /git/linux/tools/include/linux/bits.h:6,
                       from /git/linux/tools/include/linux/bitops.h:13,
                       from ../lib/find_bit.c:17:
      
        # cd /git/linux/tools/include/../../arch/x86/include/uapi/asm/
        # pwd
        /git/linux/arch/x86/include/uapi/asm
        #
      
      Now it is getting the one we want it to, i.e. the one inside tools/:
      
          CC       /tmp/build/perf/util/find_bit.o
        In file included from /git/linux/tools/arch/x86/include/uapi/asm/bitsperlong.h:11,
                         from /git/linux/tools/include/linux/bits.h:6,
                         from /git/linux/tools/include/linux/bitops.h:13,
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-8f8cfqywmf6jk8a3ucr0ixhu@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5466c30b
    • Kunihiko Hayashi's avatar
      ASoC: uniphier: Fix double reset assersion when transitioning to suspend state · b1f1b83e
      Kunihiko Hayashi authored
      [ Upstream commit c372a355 ]
      
      When transitioning to supend state, uniphier_aio_dai_suspend() is called
      and asserts reset lines and disables clocks.
      
      However, if there are two or more DAIs, uniphier_aio_dai_suspend() are
      called multiple times, and double reset assersion will cause.
      
      This patch defines the counter that has the number of DAIs at first, and
      whenever uniphier_aio_dai_suspend() are called, it decrements the
      counter. And only if the counter is zero, it asserts reset lines and
      disables clocks.
      
      In the same way, uniphier_aio_dai_resume() are called, it increments the
      counter after deasserting reset lines and enabling clocks.
      
      Fixes: 139a3420 ("ASoC: uniphier: add support for UniPhier AIO CPU DAI driver")
      Signed-off-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
      Link: https://lore.kernel.org/r/1566281764-14059-1-git-send-email-hayashi.kunihiko@socionext.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b1f1b83e
    • Hans Verkuil's avatar
      media: hdpvr: add terminating 0 at end of string · e6bc6e2c
      Hans Verkuil authored
      [ Upstream commit 8b8900b7 ]
      
      dev->usbc_buf was passed as argument for %s, but it was not safeguarded
      by a terminating 0.
      
      This caused this syzbot issue:
      
      https://syzkaller.appspot.com/bug?extid=79d18aac4bf1770dd050
      
      Reported-and-tested-by: syzbot+79d18aac4bf1770dd050@syzkaller.appspotmail.com
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e6bc6e2c
    • Hans Verkuil's avatar
      media: radio/si470x: kill urb on error · 4a2cb760
      Hans Verkuil authored
      [ Upstream commit 0d616f2a ]
      
      In the probe() function radio->int_in_urb was not killed if an
      error occurred in the probe sequence. It was also missing in
      the disconnect.
      
      This caused this syzbot issue:
      
      https://syzkaller.appspot.com/bug?extid=2d4fc2a0c45ad8da7e99
      
      Reported-and-tested-by: syzbot+2d4fc2a0c45ad8da7e99@syzkaller.appspotmail.com
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4a2cb760
    • Stefan Agner's avatar
      ARM: dts: imx7-colibri: disable HS400 · dfaf6058
      Stefan Agner authored
      [ Upstream commit a95fbda0 ]
      
      Force HS200 by masking bit 63 of the SDHCI capability register.
      The i.MX ESDHC driver uses SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400. With
      that the stack checks bit 63 to descide whether HS400 is available.
      Using sdhci-caps-mask allows to mask bit 63. The stack then selects
      HS200 as operating mode.
      
      This prevents rare communication errors with minimal effect on
      performance:
      	sdhci-esdhc-imx 30b60000.usdhc: warning! HS400 strobe DLL
      		status REF not lock!
      Signed-off-by: default avatarStefan Agner <stefan.agner@toradex.com>
      Signed-off-by: default avatarPhilippe Schenker <philippe.schenker@toradex.com>
      Reviewed-by: default avatarOleksandr Suvorov <oleksandr.suvorov@toradex.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dfaf6058
    • André Draszik's avatar
      ARM: dts: imx7d: cl-som-imx7: make ethernet work again · c20ee5d9
      André Draszik authored
      [ Upstream commit 9846a452 ]
      
      Recent changes to the atheros at803x driver caused
      ethernet to stop working on this board.
      In particular commit 6d4cd041
      ("net: phy: at803x: disable delay only for RGMII mode")
      and commit cd28d1d6
      ("net: phy: at803x: Disable phy delay for RGMII mode")
      fix the AR8031 driver to configure the phy's (RX/TX)
      delays as per the 'phy-mode' in the device tree.
      
      This now prevents ethernet from working on this board.
      
      It used to work before those commits, because the
      AR8031 comes out of reset with RX delay enabled, and
      the at803x driver didn't touch the delay configuration
      at all when "rgmii" mode was selected, and because
      arch/arm/mach-imx/mach-imx7d.c:ar8031_phy_fixup()
      unconditionally enables TX delay.
      
      Since above commits ar8031_phy_fixup() also has no
      effect anymore, and the end-result is that all delays
      are disabled in the phy, no ethernet.
      
      Update the device tree to restore functionality.
      Signed-off-by: default avatarAndré Draszik <git@andred.net>
      CC: Ilya Ledvich <ilya@compulab.co.il>
      CC: Igor Grinberg <grinberg@compulab.co.il>
      CC: Rob Herring <robh+dt@kernel.org>
      CC: Mark Rutland <mark.rutland@arm.com>
      CC: Shawn Guo <shawnguo@kernel.org>
      CC: Sascha Hauer <s.hauer@pengutronix.de>
      CC: Pengutronix Kernel Team <kernel@pengutronix.de>
      CC: Fabio Estevam <festevam@gmail.com>
      CC: NXP Linux Team <linux-imx@nxp.com>
      CC: devicetree@vger.kernel.org
      CC: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c20ee5d9
    • Finn Thain's avatar
      m68k: Prevent some compiler warnings in Coldfire builds · 21927786
      Finn Thain authored
      [ Upstream commit 94c04390 ]
      
      Since commit d3b41b6b ("m68k: Dispatch nvram_ops calls to Atari or
      Mac functions"), Coldfire builds generate compiler warnings due to the
      unconditional inclusion of asm/atarihw.h and asm/macintosh.h.
      
      The inclusion of asm/atarihw.h causes warnings like this:
      
      In file included from ./arch/m68k/include/asm/atarihw.h:25:0,
                       from arch/m68k/kernel/setup_mm.c:41,
                       from arch/m68k/kernel/setup.c:3:
      ./arch/m68k/include/asm/raw_io.h:39:0: warning: "__raw_readb" redefined
       #define __raw_readb in_8
      
      In file included from ./arch/m68k/include/asm/io.h:6:0,
                       from arch/m68k/kernel/setup_mm.c:36,
                       from arch/m68k/kernel/setup.c:3:
      ./arch/m68k/include/asm/io_no.h:16:0: note: this is the location of the previous definition
       #define __raw_readb(addr) \
      ...
      
      This issue is resolved by dropping the asm/raw_io.h include. It turns out
      that asm/io_mm.h already includes that header file.
      
      Moving the relevant macro definitions helps to clarify this dependency
      and make it safe to include asm/atarihw.h.
      
      The other warnings look like this:
      
      In file included from arch/m68k/kernel/setup_mm.c:48:0,
                       from arch/m68k/kernel/setup.c:3:
      ./arch/m68k/include/asm/macintosh.h:19:35: warning: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration
       extern void mac_irq_enable(struct irq_data *data);
                                         ^~~~~~~~
      ...
      
      This issue is resolved by adding the missing linux/irq.h include.
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      21927786
    • Arnd Bergmann's avatar
      net: lpc-enet: fix printk format strings · ba8f56ff
      Arnd Bergmann authored
      [ Upstream commit de6f97b2 ]
      
      compile-testing this driver on other architectures showed
      multiple warnings:
      
        drivers/net/ethernet/nxp/lpc_eth.c: In function 'lpc_eth_drv_probe':
        drivers/net/ethernet/nxp/lpc_eth.c:1337:19: warning: format '%d' expects argument of type 'int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]
      
        drivers/net/ethernet/nxp/lpc_eth.c:1342:19: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
      
      Use format strings that work on all architectures.
      
      Link: https://lore.kernel.org/r/20190809144043.476786-10-arnd@arndb.deReported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba8f56ff
    • Ezequiel Garcia's avatar
      media: imx: mipi csi-2: Don't fail if initial state times-out · aa2d05a9
      Ezequiel Garcia authored
      [ Upstream commit 0d5078c7 ]
      
      Not all sensors will be able to guarantee a proper initial state.
      This may be either because the driver is not properly written,
      or (probably unlikely) because the hardware won't support it.
      
      While the right solution in the former case is to fix the sensor
      driver, the real world not always allows right solutions, due to lack
      of available documentation and support on these sensors.
      
      Let's relax this requirement, and allow the driver to support stream start,
      even if the sensor initial sequence wasn't the expected.
      
      Also improve the warning message to better explain the problem and provide
      a hint that the sensor driver needs to be fixed.
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Reviewed-by: default avatarSteve Longerbeam <slongerbeam@gmail.com>
      Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aa2d05a9
    • Sakari Ailus's avatar
      media: omap3isp: Don't set streaming state on random subdevs · 1b7df445
      Sakari Ailus authored
      [ Upstream commit 7ef57be0 ]
      
      The streaming state should be set to the first upstream sub-device only,
      not everywhere, for a sub-device driver itself knows how to best control
      the streaming state of its own upstream sub-devices.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1b7df445
    • Ezequiel Garcia's avatar
      media: i2c: ov5645: Fix power sequence · 0c380217
      Ezequiel Garcia authored
      [ Upstream commit 092e8eb9 ]
      
      This is mostly a port of Jacopo's fix:
      
        commit aa4bb8b8
        Author: Jacopo Mondi <jacopo@jmondi.org>
        Date:   Fri Jul 6 05:51:52 2018 -0400
      
        media: ov5640: Re-work MIPI startup sequence
      
      In the OV5645 case, the changes are:
      
      - At set_power(1) time power up MIPI Tx/Rx and set data and clock lanes in
        LP11 during 'sleep' and 'idle' with MIPI clock in non-continuous mode.
      - At set_power(0) time power down MIPI Tx/Rx (in addition to the current
        power down of regulators and clock gating).
      - At s_stream time enable/disable the MIPI interface output.
      
      With this commit the sensor is able to enter LP-11 mode during power up,
      as expected by some CSI-2 controllers.
      
      Many thanks to Fabio Estevam for his help debugging this issue.
      Tested-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Reviewed-by: default avatarJacopo Mondi <jacopo@jmondi.org>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0c380217
    • Colin Ian King's avatar
      media: vsp1: fix memory leak of dl on error return path · 3dfbac0a
      Colin Ian King authored
      [ Upstream commit 70c55c1a ]
      
      Currently when the call vsp1_dl_body_get fails and returns null the
      error return path leaks the allocation of dl. Fix this by kfree'ing
      dl before returning.
      
      Addresses-Coverity: ("Resource leak")
      
      Fixes: 5d7936b8 ("media: vsp1: Convert display lists to use new body pool")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3dfbac0a
    • Tan Xiaojun's avatar
      perf record: Support aarch64 random socket_id assignment · c47022e0
      Tan Xiaojun authored
      [ Upstream commit 0a4d8fb2 ]
      
      Same as in the commit 01766229 ("perf record: Support s390 random
      socket_id assignment"), aarch64 also have this problem.
      
      Without this fix:
      
        [root@localhost perf]# ./perf report --header -I -v
        ...
        socket_id number is too big.You may need to upgrade the perf tool.
      
        # ========
        # captured on    : Thu Aug  1 22:58:38 2019
        # header version : 1
        ...
        # Core ID and Socket ID information is not available
        ...
      
      With this fix:
        [root@localhost perf]# ./perf report --header -I -v
        ...
        cpumask list: 0-31
        cpumask list: 32-63
        cpumask list: 64-95
        cpumask list: 96-127
      
        # ========
        # captured on    : Thu Aug  1 22:58:38 2019
        # header version : 1
        ...
        # CPU 0: Core ID 0, Socket ID 36
        # CPU 1: Core ID 1, Socket ID 36
        ...
        # CPU 126: Core ID 126, Socket ID 8442
        # CPU 127: Core ID 127, Socket ID 8442
        ...
      Signed-off-by: default avatarTan Xiaojun <tanxiaojun@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
      Link: http://lkml.kernel.org/r/1564717737-21602-1-git-send-email-tanxiaojun@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c47022e0
    • Arnd Bergmann's avatar
      dmaengine: iop-adma: use correct printk format strings · 482c1d0a
      Arnd Bergmann authored
      [ Upstream commit 00c97555 ]
      
      When compile-testing on other architectures, we get lots of warnings
      about incorrect format strings, like:
      
         drivers/dma/iop-adma.c: In function 'iop_adma_alloc_slots':
         drivers/dma/iop-adma.c:307:6: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
      
         drivers/dma/iop-adma.c: In function 'iop_adma_prep_dma_memcpy':
      >> drivers/dma/iop-adma.c:518:40: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
      
      Use %zu for printing size_t as required, and cast the dma_addr_t
      arguments to 'u64' for printing with %llx. Ideally this should use
      the %pad format string, but that requires an lvalue argument that
      doesn't work here.
      
      Link: https://lore.kernel.org/r/20190809163334.489360-3-arnd@arndb.deSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      482c1d0a
    • Darius Rad's avatar
      media: rc: imon: Allow iMON RC protocol for ffdc 7e device · 19a1fa14
      Darius Rad authored
      [ Upstream commit b20a6e29 ]
      
      Allow selecting the IR protocol, MCE or iMON, for a device that
      identifies as follows (with config id 0x7e):
      
      15c2:ffdc SoundGraph Inc. iMON PAD Remote Controller
      
      As the driver is structured to default to iMON when both RC
      protocols are supported, existing users of this device (using MCE
      protocol) will need to manually switch to MCE (RC-6) protocol from
      userspace (with ir-keytable, sysfs).
      Signed-off-by: default avatarDarius Rad <alpha@area49.net>
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      19a1fa14
    • Sean Young's avatar
      media: em28xx: modules workqueue not inited for 2nd device · a527d3d4
      Sean Young authored
      [ Upstream commit 46e4a266 ]
      
      syzbot reports an error on flush_request_modules() for the second device.
      This workqueue was never initialised so simply remove the offending line.
      
      usb 1-1: USB disconnect, device number 2
      em28xx 1-1:1.153: Disconnecting em28xx #1
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 12 at kernel/workqueue.c:3031
      __flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
      Kernel panic - not syncing: panic_on_warn set ...
      CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.3.0-rc2+ #25
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Workqueue: usb_hub_wq hub_event
      Call Trace:
        __dump_stack lib/dump_stack.c:77 [inline]
        dump_stack+0xca/0x13e lib/dump_stack.c:113
        panic+0x2a3/0x6da kernel/panic.c:219
        __warn.cold+0x20/0x4a kernel/panic.c:576
        report_bug+0x262/0x2a0 lib/bug.c:186
        fixup_bug arch/x86/kernel/traps.c:179 [inline]
        fixup_bug arch/x86/kernel/traps.c:174 [inline]
        do_error_trap+0x12b/0x1e0 arch/x86/kernel/traps.c:272
        do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:291
        invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1026
      RIP: 0010:__flush_work.cold+0x2c/0x36 kernel/workqueue.c:3031
      Code: 9a 22 00 48 c7 c7 20 e4 c5 85 e8 d9 3a 0d 00 0f 0b 45 31 e4 e9 98 86
      ff ff e8 51 9a 22 00 48 c7 c7 20 e4 c5 85 e8 be 3a 0d 00 <0f> 0b 45 31 e4
      e9 7d 86 ff ff e8 36 9a 22 00 48 c7 c7 20 e4 c5 85
      RSP: 0018:ffff8881da20f720 EFLAGS: 00010286
      RAX: 0000000000000024 RBX: dffffc0000000000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffffffff8128a0fd RDI: ffffed103b441ed6
      RBP: ffff8881da20f888 R08: 0000000000000024 R09: fffffbfff11acd9a
      R10: fffffbfff11acd99 R11: ffffffff88d66ccf R12: 0000000000000000
      R13: 0000000000000001 R14: ffff8881c6685df8 R15: ffff8881d2a85b78
        flush_request_modules drivers/media/usb/em28xx/em28xx-cards.c:3325 [inline]
        em28xx_usb_disconnect.cold+0x280/0x2a6
      drivers/media/usb/em28xx/em28xx-cards.c:4023
        usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423
        __device_release_driver drivers/base/dd.c:1120 [inline]
        device_release_driver_internal+0x404/0x4c0 drivers/base/dd.c:1151
        bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:556
        device_del+0x420/0xb10 drivers/base/core.c:2288
        usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237
        usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199
        hub_port_connect drivers/usb/core/hub.c:4949 [inline]
        hub_port_connect_change drivers/usb/core/hub.c:5213 [inline]
        port_event drivers/usb/core/hub.c:5359 [inline]
        hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441
        process_one_work+0x92b/0x1530 kernel/workqueue.c:2269
        process_scheduled_works kernel/workqueue.c:2331 [inline]
        worker_thread+0x7ab/0xe20 kernel/workqueue.c:2417
        kthread+0x318/0x420 kernel/kthread.c:255
        ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
      Kernel Offset: disabled
      Rebooting in 86400 seconds..
      
      Fixes: be7fd3c3 ("media: em28xx: Hauppauge DualHD second tuner functionality)
      Reviewed-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Reviewed-by: default avatarBrad Love <brad@nextdimension.cc>
      Reported-by: syzbot+b7f57261c521087d89bb@syzkaller.appspotmail.com
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a527d3d4
    • Geert Uytterhoeven's avatar
      media: fdp1: Reduce FCP not found message level to debug · 6a1c59a7
      Geert Uytterhoeven authored
      [ Upstream commit 4fd22938 ]
      
      When support for the IPMMU is not enabled, the FDP driver may be
      probe-deferred multiple times, causing several messages to be printed
      like:
      
          rcar_fdp1 fe940000.fdp1: FCP not found (-517)
          rcar_fdp1 fe944000.fdp1: FCP not found (-517)
      
      Fix this by reducing the message level to debug level, as is done in the
      VSP1 driver.
      
      Fixes: 4710b752 ("[media] v4l: Add Renesas R-Car FDP1 Driver")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6a1c59a7
    • Matthias Brugger's avatar
      media: mtk-mdp: fix reference count on old device tree · e3f5f626
      Matthias Brugger authored
      [ Upstream commit 864919ea ]
      
      of_get_next_child() increments the reference count of the returning
      device_node. Decrement it in the check if we are using the old or the
      new DTB.
      
      Fixes: ba1f1f70 ("[media] media: mtk-mdp: Fix mdp device tree")
      Signed-off-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
      Acked-by: default avatarHoulong Wei <houlong.wei@mediatek.com>
      [hverkuil-cisco@xs4all.nl: use node instead of parent as temp variable]
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e3f5f626
    • Arnaldo Carvalho de Melo's avatar
      perf test vfs_getname: Disable ~/.perfconfig to get default output · 066afce8
      Arnaldo Carvalho de Melo authored
      [ Upstream commit 4fe94ce1 ]
      
      To get the expected output we have to ignore whatever changes the user
      has in its ~/.perfconfig file, so set PERF_CONFIG to /dev/null to
      achieve that.
      
      Before:
      
        # egrep 'trace|show_' ~/.perfconfig
        [trace]
        	show_zeros = yes
        	show_duration = no
        	show_timestamp = no
        	show_arg_names = no
        	show_prefix = yes
        # echo $PERF_CONFIG
      
        # perf test "trace + vfs_getname"
        70: Check open filename arg using perf trace + vfs_getname: FAILED!
        # export PERF_CONFIG=/dev/null
        # perf test "trace + vfs_getname"
        70: Check open filename arg using perf trace + vfs_getname: Ok
        #
      
      After:
      
        # egrep 'trace|show_' ~/.perfconfig
        [trace]
        	show_zeros = yes
        	show_duration = no
        	show_timestamp = no
        	show_arg_names = no
        	show_prefix = yes
        # echo $PERF_CONFIG
      
        # perf test "trace + vfs_getname"
        70: Check open filename arg using perf trace + vfs_getname: Ok
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: https://lkml.kernel.org/n/tip-3up27pexg5i3exuzqrvt4m8u@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      066afce8
    • Arnaldo Carvalho de Melo's avatar
      perf config: Honour $PERF_CONFIG env var to specify alternate .perfconfig · 96b61fe7
      Arnaldo Carvalho de Melo authored
      [ Upstream commit 61a461fc ]
      
      We had this comment in Documentation/perf_counter/config.c, i.e. since
      when we got this from the git sources, but never really did that
      getenv("PERF_CONFIG"), do it now as I need to disable whatever
      ~/.perfconfig root has so that tests parsing tool output are done for
      the expected default output or that we specify an alternate config file
      that when read will make the tools produce expected output.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Fixes: 07800601 ("perf_counter tools: add in basic glue from Git")
      Link: https://lkml.kernel.org/n/tip-jo209zac9rut0dz1rqvbdlgm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      96b61fe7
    • Hans Verkuil's avatar
      media: gspca: zero usb_buf on error · db751f6d
      Hans Verkuil authored
      [ Upstream commit 4843a543 ]
      
      If reg_r() fails, then gspca_dev->usb_buf was left uninitialized,
      and some drivers used the contents of that buffer in logic.
      
      This caused several syzbot errors:
      
      https://syzkaller.appspot.com/bug?extid=397fd082ce5143e2f67d
      https://syzkaller.appspot.com/bug?extid=1a35278dd0ebfb3a038a
      https://syzkaller.appspot.com/bug?extid=06ddf1788cfd048c5e82
      
      I analyzed the gspca drivers and zeroed the buffer where needed.
      
      Reported-and-tested-by: syzbot+1a35278dd0ebfb3a038a@syzkaller.appspotmail.com
      Reported-and-tested-by: syzbot+397fd082ce5143e2f67d@syzkaller.appspotmail.com
      Reported-and-tested-by: syzbot+06ddf1788cfd048c5e82@syzkaller.appspotmail.com
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      db751f6d
    • Peter Zijlstra's avatar
      idle: Prevent late-arriving interrupts from disrupting offline · 51111023
      Peter Zijlstra authored
      [ Upstream commit e78a7614 ]
      
      Scheduling-clock interrupts can arrive late in the CPU-offline process,
      after idle entry and the subsequent call to cpuhp_report_idle_dead().
      Once execution passes the call to rcu_report_dead(), RCU is ignoring
      the CPU, which results in lockdep complaints when the interrupt handler
      uses RCU:
      
      ------------------------------------------------------------------------
      
      =============================
      WARNING: suspicious RCU usage
      5.2.0-rc1+ #681 Not tainted
      -----------------------------
      kernel/sched/fair.c:9542 suspicious rcu_dereference_check() usage!
      
      other info that might help us debug this:
      
      RCU used illegally from offline CPU!
      rcu_scheduler_active = 2, debug_locks = 1
      no locks held by swapper/5/0.
      
      stack backtrace:
      CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.2.0-rc1+ #681
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Bochs 01/01/2011
      Call Trace:
       <IRQ>
       dump_stack+0x5e/0x8b
       trigger_load_balance+0xa8/0x390
       ? tick_sched_do_timer+0x60/0x60
       update_process_times+0x3b/0x50
       tick_sched_handle+0x2f/0x40
       tick_sched_timer+0x32/0x70
       __hrtimer_run_queues+0xd3/0x3b0
       hrtimer_interrupt+0x11d/0x270
       ? sched_clock_local+0xc/0x74
       smp_apic_timer_interrupt+0x79/0x200
       apic_timer_interrupt+0xf/0x20
       </IRQ>
      RIP: 0010:delay_tsc+0x22/0x50
      Code: ff 0f 1f 80 00 00 00 00 65 44 8b 05 18 a7 11 48 0f ae e8 0f 31 48 89 d6 48 c1 e6 20 48 09 c6 eb 0e f3 90 65 8b 05 fe a6 11 48 <41> 39 c0 75 18 0f ae e8 0f 31 48 c1 e2 20 48 09 c2 48 89 d0 48 29
      RSP: 0000:ffff8f92c0157ed0 EFLAGS: 00000212 ORIG_RAX: ffffffffffffff13
      RAX: 0000000000000005 RBX: ffff8c861f356400 RCX: ffff8f92c0157e64
      RDX: 000000321214c8cc RSI: 00000032120daa7f RDI: 0000000000260f15
      RBP: 0000000000000005 R08: 0000000000000005 R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
      R13: 0000000000000000 R14: ffff8c861ee18000 R15: ffff8c861ee18000
       cpuhp_report_idle_dead+0x31/0x60
       do_idle+0x1d5/0x200
       ? _raw_spin_unlock_irqrestore+0x2d/0x40
       cpu_startup_entry+0x14/0x20
       start_secondary+0x151/0x170
       secondary_startup_64+0xa4/0xb0
      
      ------------------------------------------------------------------------
      
      This happens rarely, but can be forced by happen more often by
      placing delays in cpuhp_report_idle_dead() following the call to
      rcu_report_dead().  With this in place, the following rcutorture
      scenario reproduces the problem within a few minutes:
      
      tools/testing/selftests/rcutorture/bin/kvm.sh --cpus 8 --duration 5 --kconfig "CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y" --configs "TREE04"
      
      This commit uses the crude but effective expedient of moving the disabling
      of interrupts within the idle loop to precede the cpu_is_offline()
      check.  It also invokes tick_nohz_idle_stop_tick() instead of
      tick_nohz_idle_stop_tick_protected() to shut off the scheduling-clock
      interrupt.
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      [ paulmck: Revert tick_nohz_idle_stop_tick_protected() removal, new callers. ]
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      51111023
    • Phil Auld's avatar
      sched/fair: Use rq_lock/unlock in online_fair_sched_group · 9addfbd4
      Phil Auld authored
      [ Upstream commit a46d14ec ]
      
      Enabling WARN_DOUBLE_CLOCK in /sys/kernel/debug/sched_features causes
      warning to fire in update_rq_clock. This seems to be caused by onlining
      a new fair sched group not using the rq lock wrappers.
      
        [] rq->clock_update_flags & RQCF_UPDATED
        [] WARNING: CPU: 5 PID: 54385 at kernel/sched/core.c:210 update_rq_clock+0xec/0x150
      
        [] Call Trace:
        []  online_fair_sched_group+0x53/0x100
        []  cpu_cgroup_css_online+0x16/0x20
        []  online_css+0x1c/0x60
        []  cgroup_apply_control_enable+0x231/0x3b0
        []  cgroup_mkdir+0x41b/0x530
        []  kernfs_iop_mkdir+0x61/0xa0
        []  vfs_mkdir+0x108/0x1a0
        []  do_mkdirat+0x77/0xe0
        []  do_syscall_64+0x55/0x1d0
        []  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Using the wrappers in online_fair_sched_group instead of the raw locking
      removes this warning.
      
      [ tglx: Use rq_*lock_irq() ]
      Signed-off-by: default avatarPhil Auld <pauld@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Link: https://lkml.kernel.org/r/20190801133749.11033-1-pauld@redhat.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      9addfbd4
    • Sudeep Holla's avatar
      firmware: arm_scmi: Check if platform has released shmem before using · 6e9d4502
      Sudeep Holla authored
      [ Upstream commit 9dc34d63 ]
      
      Sometimes platfom may take too long to respond to the command and OS
      might timeout before platform transfer the ownership of the shared
      memory region to the OS with the response.
      
      Since the mailbox channel associated with the channel is freed and new
      commands are dispatch on the same channel, OS needs to wait until it
      gets back the ownership. If not, either OS may end up overwriting the
      platform response for the last command(which is fine as OS timed out
      that command) or platform might overwrite the payload for the next
      command with the response for the old.
      
      The latter is problematic as platform may end up interpretting the
      response as the payload. In order to avoid such race, let's wait until
      the OS gets back the ownership before we prepare the shared memory with
      the payload for the next command.
      Reported-by: default avatarJim Quinlan <james.quinlan@broadcom.com>
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6e9d4502
    • Xiaofei Tan's avatar
      efi: cper: print AER info of PCIe fatal error · 0dbdc198
      Xiaofei Tan authored
      [ Upstream commit b194a77f ]
      
      AER info of PCIe fatal error is not printed in the current driver.
      Because APEI driver will panic directly for fatal error, and can't
      run to the place of printing AER info.
      
      An example log is as following:
      {763}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 11
      {763}[Hardware Error]: event severity: fatal
      {763}[Hardware Error]:  Error 0, type: fatal
      {763}[Hardware Error]:   section_type: PCIe error
      {763}[Hardware Error]:   port_type: 0, PCIe end point
      {763}[Hardware Error]:   version: 4.0
      {763}[Hardware Error]:   command: 0x0000, status: 0x0010
      {763}[Hardware Error]:   device_id: 0000:82:00.0
      {763}[Hardware Error]:   slot: 0
      {763}[Hardware Error]:   secondary_bus: 0x00
      {763}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x10fb
      {763}[Hardware Error]:   class_code: 000002
      Kernel panic - not syncing: Fatal hardware error!
      
      This issue was imported by the patch, '37448adf ("aerdrv: Move
      cper_print_aer() call out of interrupt context")'. To fix this issue,
      this patch adds print of AER info in cper_print_pcie() for fatal error.
      
      Here is the example log after this patch applied:
      {24}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 10
      {24}[Hardware Error]: event severity: fatal
      {24}[Hardware Error]:  Error 0, type: fatal
      {24}[Hardware Error]:   section_type: PCIe error
      {24}[Hardware Error]:   port_type: 0, PCIe end point
      {24}[Hardware Error]:   version: 4.0
      {24}[Hardware Error]:   command: 0x0546, status: 0x4010
      {24}[Hardware Error]:   device_id: 0000:01:00.0
      {24}[Hardware Error]:   slot: 0
      {24}[Hardware Error]:   secondary_bus: 0x00
      {24}[Hardware Error]:   vendor_id: 0x15b3, device_id: 0x1019
      {24}[Hardware Error]:   class_code: 000002
      {24}[Hardware Error]:   aer_uncor_status: 0x00040000, aer_uncor_mask: 0x00000000
      {24}[Hardware Error]:   aer_uncor_severity: 0x00062010
      {24}[Hardware Error]:   TLP Header: 000000c0 01010000 00000001 00000000
      Kernel panic - not syncing: Fatal hardware error!
      
      Fixes: 37448adf ("aerdrv: Move cper_print_aer() call out of interrupt context")
      Signed-off-by: default avatarXiaofei Tan <tanxiaofei@huawei.com>
      Reviewed-by: default avatarJames Morse <james.morse@arm.com>
      [ardb: put parens around terms of && operator]
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0dbdc198
    • Stephen Douthit's avatar
      EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() · 4410b851
      Stephen Douthit authored
      [ Upstream commit 29a3388b ]
      
      Depending on how BIOS has marked the reserved region containing the 32KB
      MCHBAR you can get warnings like:
      
      resource sanity check: requesting [mem 0xfed10000-0xfed1ffff], which spans more than reserved [mem 0xfed10000-0xfed17fff]
      caller dnv_rd_reg+0xc8/0x240 [pnd2_edac] mapping multiple BARs
      
      Not all of the mmio regions used in dnv_rd_reg() are the same size.  The
      MCHBAR window is 32KB and the sideband ports are 64KB.  Pass the correct
      size to ioremap() depending on which resource we're reading from.
      Signed-off-by: default avatarStephen Douthit <stephend@silicom-usa.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4410b851
    • Alessio Balsini's avatar
      loop: Add LOOP_SET_DIRECT_IO to compat ioctl · cf8f20a1
      Alessio Balsini authored
      [ Upstream commit fdbe4eee ]
      
      Enabling Direct I/O with loop devices helps reducing memory usage by
      avoiding double caching.  32 bit applications running on 64 bits systems
      are currently not able to request direct I/O because is missing from the
      lo_compat_ioctl.
      
      This patch fixes the compatibility issue mentioned above by exporting
      LOOP_SET_DIRECT_IO as additional lo_compat_ioctl() entry.
      The input argument for this ioctl is a single long converted to a 1-bit
      boolean, so compatibility is preserved.
      
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAlessio Balsini <balsini@android.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cf8f20a1
    • Jiri Slaby's avatar
      ACPI / processor: don't print errors for processorIDs == 0xff · 18e5e458
      Jiri Slaby authored
      [ Upstream commit 2c2b005f ]
      
      Some platforms define their processors in this manner:
          Device (SCK0)
          {
      	Name (_HID, "ACPI0004" /* Module Device */)  // _HID: Hardware ID
      	Name (_UID, "CPUSCK0")  // _UID: Unique ID
      	Processor (CP00, 0x00, 0x00000410, 0x06){}
      	Processor (CP01, 0x02, 0x00000410, 0x06){}
      	Processor (CP02, 0x04, 0x00000410, 0x06){}
      	Processor (CP03, 0x06, 0x00000410, 0x06){}
      	Processor (CP04, 0x01, 0x00000410, 0x06){}
      	Processor (CP05, 0x03, 0x00000410, 0x06){}
      	Processor (CP06, 0x05, 0x00000410, 0x06){}
      	Processor (CP07, 0x07, 0x00000410, 0x06){}
      	Processor (CP08, 0xFF, 0x00000410, 0x06){}
      	Processor (CP09, 0xFF, 0x00000410, 0x06){}
      	Processor (CP0A, 0xFF, 0x00000410, 0x06){}
      	Processor (CP0B, 0xFF, 0x00000410, 0x06){}
      ...
      
      The processors marked as 0xff are invalid, there are only 8 of them in
      this case.
      
      So do not print an error on ids == 0xff, just print an info message.
      Actually, we could return ENODEV even on the first CPU with ID 0xff, but
      ACPI spec does not forbid the 0xff value to be a processor ID. Given
      0xff could be a correct one, we would break working systems if we
      returned ENODEV.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      18e5e458
    • Randy Dunlap's avatar
      media: media/platform: fsl-viu.c: fix build for MICROBLAZE · 465bc6e8
      Randy Dunlap authored
      [ Upstream commit 6898dd58 ]
      
      arch/microblaze/ defines out_be32() and in_be32(), so don't do that
      again in the driver source.
      
      Fixes these build warnings:
      
      ../drivers/media/platform/fsl-viu.c:36: warning: "out_be32" redefined
      ../arch/microblaze/include/asm/io.h:50: note: this is the location of the previous definition
      ../drivers/media/platform/fsl-viu.c:37: warning: "in_be32" redefined
      ../arch/microblaze/include/asm/io.h:53: note: this is the location of the previous definition
      
      Fixes: 29d75068 ("media: fsl-viu: allow building it with COMPILE_TEST")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      465bc6e8
    • Guoqing Jiang's avatar
      md: don't set In_sync if array is frozen · 37153845
      Guoqing Jiang authored
      [ Upstream commit 062f5b2a ]
      
      When a disk is added to array, the following path is called in mdadm.
      
      Manage_subdevs -> sysfs_freeze_array
                     -> Manage_add
                     -> sysfs_set_str(&info, NULL, "sync_action","idle")
      
      Then from kernel side, Manage_add invokes the path (add_new_disk ->
      validate_super = super_1_validate) to set In_sync flag.
      
      Since In_sync means "device is in_sync with rest of array", and the new
      added disk need to resync thread to help the synchronization of data.
      And md_reap_sync_thread would call spare_active to set In_sync for the
      new added disk finally. So don't set In_sync if array is in frozen.
      Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37153845
    • Guoqing Jiang's avatar
      md: don't call spare_active in md_reap_sync_thread if all member devices can't work · d38aff20
      Guoqing Jiang authored
      [ Upstream commit 0d8ed0e9 ]
      
      When add one disk to array, the md_reap_sync_thread is responsible
      to activate the spare and set In_sync flag for the new member in
      spare_active().
      
      But if raid1 has one member disk A, and disk B is added to the array.
      Then we offline A before all the datas are synchronized from A to B,
      obviously B doesn't have the latest data as A, but B is still marked
      with In_sync flag.
      
      So let's not call spare_active under the condition, otherwise B is
      still showed with 'U' state which is not correct.
      Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d38aff20