30 Dec, 2020

40 commits

  • commit dcf5aedb24f899d537e21c18ea552c780598d352 upstream.

    Use temporary slots in reclaim function to avoid possible race when
    freeing those.

    While at it, make sure we check CLAIMED flag under page lock in the
    reclaim function to make sure we are not racing with z3fold_alloc().

    Link: https://lkml.kernel.org/r/20201209145151.18994-4-vitaly.wool@konsulko.com
    Signed-off-by: Vitaly Wool
    Cc:
    Cc: Mike Galbraith
    Cc: Sebastian Andrzej Siewior
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Wool
     
  • commit fc5488651c7d840c9cad9b0f273f2f31bd03413a upstream.

    Patch series "z3fold: stability / rt fixes".

    Address z3fold stability issues under stress load, primarily in the
    reclaim and free aspects. Besides, it fixes the locking problems that
    were only seen in real-time kernel configuration.

    This patch (of 3):

    There used to be two places in the code where slots could be freed, namely
    when freeing the last allocated handle from the slots and when releasing
    the z3fold header these slots aree linked to. The logic to decide on
    whether to free certain slots was complicated and error prone in both
    functions and it led to failures in RT case.

    To fix that, make free_handle() the single point of freeing slots.

    Link: https://lkml.kernel.org/r/20201209145151.18994-1-vitaly.wool@konsulko.com
    Link: https://lkml.kernel.org/r/20201209145151.18994-2-vitaly.wool@konsulko.com
    Signed-off-by: Vitaly Wool
    Tested-by: Mike Galbraith
    Cc: Sebastian Andrzej Siewior
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Wool
     
  • commit 56c90457ebfe9422496aac6ef3d3f0f0ea8b2ec2 upstream.

    I have had reports from two different people that attempts to read the
    analog input channels of the MF624 board fail with an `ETIMEDOUT` error.

    After triggering the conversion, the code calls `comedi_timeout()` with
    `mf6x4_ai_eoc()` as the callback function to check if the conversion is
    complete. The callback returns 0 if complete or `-EBUSY` if not yet
    complete. `comedi_timeout()` returns `-ETIMEDOUT` if it has not
    completed within a timeout period which is propagated as an error to the
    user application.

    The existing code considers the conversion to be complete when the EOLC
    bit is high. However, according to the user manuals for the MF624 and
    MF634 boards, this test is incorrect because EOLC is an active low
    signal that goes high when the conversion is triggered, and goes low
    when the conversion is complete. Fix the problem by inverting the test
    of the EOLC bit state.

    Fixes: 04b565021a83 ("comedi: Humusoft MF634 and MF624 DAQ cards driver")
    Cc: # v4.4+
    Cc: Rostislav Lisovy
    Signed-off-by: Ian Abbott
    Link: https://lore.kernel.org/r/20201207145806.4046-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman

    Ian Abbott
     
  • commit 55d8e6a85bce21f748c42eedea63681219f70523 upstream.

    The Raven and Renoir ACP can be distinguished by the PCI revision.
    Let's do the check very early, otherwise the wrong probe code
    can be run.

    Link: https://lore.kernel.org/alsa-devel/2e4587f8-f602-cf23-4845-fd27a32b1cfc@amd.com/
    Cc:
    Cc: Vijendar Mukunda
    Cc: Mark Brown
    Signed-off-by: Jaroslav Kysela
    Link: https://lore.kernel.org/r/20201208181233.2745726-1-perex@perex.cz
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Jaroslav Kysela
     
  • commit 718c406e1ffaca4eac987b957bbb36ce1090797a upstream.

    Users reported that some Lenovo AMD platforms do not have ACP microphone,
    but the BIOS advertises it via ACPI.

    This patch create a simple DMI table, where those machines with the broken
    BIOS can be added. The DMI description for Lenovo IdeaPad 5 and
    IdeaPad Flex 5 devices are added there.

    Also describe the dmic_acpi_check kernel module parameter in a more
    understandable way.

    Cc:
    Cc: Vijendar Mukunda
    Cc: Mark Brown
    Signed-off-by: Jaroslav Kysela
    Link: https://lore.kernel.org/r/20201208171200.2737620-1-perex@perex.cz
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Jaroslav Kysela
     
  • commit 0d024a8bec084205fdd9fa17479ba91f45f85db3 upstream.

    The cx2072x codec driver defines multiple DAIs with the same stream
    name "Playback" and "Capture". Although the current code works more
    or less as is as the secondary streams are never used, it still leads
    the error message like:
    debugfs: File 'Playback' in directory 'dapm' already present!
    debugfs: File 'Capture' in directory 'dapm' already present!

    Fix it by renaming the secondary streams to unique names.

    Fixes: a497a4363706 ("ASoC: Add support for Conexant CX2072X CODEC")
    Cc:
    Signed-off-by: Takashi Iwai
    Link: https://lore.kernel.org/r/20201208135154.9188-1-tiwai@suse.de
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 0f966cba95c78029f491b433ea95ff38f414a761 upstream.

    Add a per-transaction flag to indicate that the buffer
    must be cleared when the transaction is complete to
    prevent copies of sensitive data from being preserved
    in memory.

    Signed-off-by: Todd Kjos
    Link: https://lore.kernel.org/r/20201120233743.3617529-1-tkjos@google.com
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • commit 53a7f655834c7c335bf683f248208d4fbe4b47bc upstream.

    In dasd_alias_disconnect_device_from_lcu the device is removed from any
    list on the LCU. Afterwards the LCU is removed from the lcu list if it
    does not contain devices any longer.

    The lcu->lock protects the lcu from parallel updates. But to cancel all
    workers and wait for completion the lcu->lock has to be unlocked.

    If two devices are removed in parallel and both are removed from the LCU
    the first device that takes the lcu->lock again will delete the LCU because
    it is already empty but the second device also tries to free the LCU which
    leads to a list corruption of the lcu list.

    Fix by removing the device right before the lcu is checked without
    unlocking the lcu->lock in between.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit 0ede91f83aa335da1c3ec68eb0f9e228f269f6d8 upstream.

    dasd_alias_add_device() moves devices to the active_devices list in case
    of a scheduled LCU update regardless if they have previously been in a
    pavgroup or not.

    Example: device A and B are in the same pavgroup.

    Device A has already been in a pavgroup and the private->pavgroup pointer
    is set and points to a valid pavgroup. While going through dasd_add_device
    it is moved from the pavgroup to the active_devices list.

    In parallel device B might be removed from the same pavgroup in
    remove_device_from_lcu() which in turn checks if the group is empty
    and deletes it accordingly because device A has already been removed from
    there.

    When now device A enters remove_device_from_lcu() it is tried to remove it
    from the pavgroup again because the pavgroup pointer is still set and again
    the empty group will be cleaned up which leads to a list corruption.

    Fix by setting private->pavgroup to NULL in dasd_add_device.

    If the device has been the last device on the pavgroup an empty pavgroup
    remains but this will be cleaned up by the scheduled lcu_update which
    iterates over all existing pavgroups.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit a29ea01653493b94ea12bb2b89d1564a265081b6 upstream.

    Prevent _lcu_update from adding a device to a pavgroup if the LCU still
    requires an update. The data is not reliable any longer and in parallel
    devices might have been moved on the lists already.
    This might lead to list corruptions or invalid PAV grouping.
    Only add devices to a pavgroup if the LCU is up to date. Additional steps
    are taken by the scheduled lcu update.

    Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit 658a337a606f48b7ebe451591f7681d383fa115e upstream.

    For an LCU update a read unit address configuration IO is required.
    This is started using sleep_on(), which has early exit paths in case the
    device is not usable for IO. For example when it is in offline processing.

    In those cases the LCU update should fail and not be retried.
    Therefore lcu_update_work checks if EOPNOTSUPP is returned or not.

    Commit 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration")
    accidentally removed the EOPNOTSUPP return code from
    read_unit_address_configuration(), which in turn might lead to an endless
    loop of the LCU update in offline processing.

    Fix by returning EOPNOTSUPP again if the device is not able to perform the
    request.

    Fixes: 41995342b40c ("s390/dasd: fix endless loop after read unit address configuration")
    Cc: stable@vger.kernel.org #5.3
    Signed-off-by: Stefan Haberland
    Reviewed-by: Jan Hoeppner
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Stefan Haberland
     
  • commit 454efcf82ea17d7efeb86ebaa20775a21ec87d27 upstream.

    When a machine check interrupt is triggered during idle, the code
    is using the async timer/clock for idle time calculation. It should use
    the machine check enter timer/clock which is passed to the macro.

    Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S")
    Cc: # 5.8
    Reviewed-by: Heiko Carstens
    Signed-off-by: Sven Schnelle
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     
  • commit e259b3fafa7de362b04ecd86e7fa9a9e9273e5fb upstream.

    During removal of the critical section cleanup the calculation
    of mt_cycles during idle was removed. This causes invalid
    accounting on systems with SMT enabled.

    Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S")
    Cc: # 5.8
    Reviewed-by: Heiko Carstens
    Signed-off-by: Sven Schnelle
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     
  • commit 613775d62ec60202f98d2c5f520e6e9ba6dd4ac4 upstream.

    diag308 subcode 0 performes a clear reset which inlcudes the reset of
    all registers in the system. While this is the preferred behavior when
    loading a normal kernel via kexec it prevents the crash kernel to store
    the register values in the dump. To prevent this use subcode 1 when
    loading a crash kernel instead.

    Fixes: ee337f5469fd ("s390/kexec_file: Add crash support to image loader")
    Cc: # 4.17
    Signed-off-by: Philipp Rudo
    Reported-by: Xiaoying Yan
    Tested-by: Lianbo Jiang
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Philipp Rudo
     
  • commit b5e438ebd7e808d1d2435159ac4742e01a94b8da upstream.

    Not resetting the SMT siblings might leave them in unpredictable
    state. One of the observed problems was that the CPU timer wasn't
    reset and therefore large system time values where accounted during
    CPU bringup.

    Cc: # 4.0
    Fixes: 10ad34bc76dfb ("s390: add SMT support")
    Reviewed-by: Heiko Carstens
    Signed-off-by: Sven Schnelle
    Signed-off-by: Heiko Carstens
    Signed-off-by: Greg Kroah-Hartman

    Sven Schnelle
     
  • commit 74c64efa1557fef731b59eb813f115436d18078e upstream.

    Since mmap for userspace is based on page alignment, add page alignment
    for iram alloc from pool, otherwise, some good data located in the same
    page of dmab->area maybe touched wrongly by userspace like pulseaudio.

    Signed-off-by: Robin Gong
    Cc:
    Link: https://lore.kernel.org/r/1608221747-3474-1-git-send-email-yibin.gong@nxp.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Robin Gong
     
  • commit 525d9c57d0eeeb660d9b25e5b2d1c95975e3ba95 upstream.

    ASUS PRIME TRX40 PRO-S mobo with 0b05:1918 needs the same quirk alias
    for another ASUS mobo (0b05:1917) for the proper mixer mapping, etc.
    Add the corresponding entry.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210783
    Cc:
    Link: https://lore.kernel.org/r/20201221080159.24468-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 9df28edce7c6ab38050235f6f8b43dd7ccd01b6d upstream.

    Some buggy firmware don't give the current sample rate but leaves
    zero. Handle this case more gracefully without warning but just skip
    the current rate verification from the next time.

    Cc:
    Link: https://lore.kernel.org/r/20201218145858.2357-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 725124d10d00b2f56bb5bd08b431cc74ab3b3ace upstream.

    Add VID to support native DSD reproduction on FiiO devices.

    Tested-by: Amadej Kastelic
    Signed-off-by: Emilio Moretti
    Signed-off-by: Amadej Kastelic
    Cc:
    Link: https://lore.kernel.org/r/X9j7wdXSr4XyK7Bd@ryzen.localdomain
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Amadej Kastelic
     
  • commit 150927c3674d7db4dd51a7269e01423c8c78e53b upstream.

    This platform only supported iphone type headset.
    It can't support Dell headset mode.

    Signed-off-by: Kailang Yang
    Cc:
    Link: https://lore.kernel.org/r/b97e971978034bc9b772a08ec91265e8@realtek.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Kailang Yang
     
  • commit 34cdf405aa5de827b8bef79a6c82c39120b3729b upstream.

    Acer TravelMate laptops P648/P658 series with codec ALC282 only have
    one physical jack for headset but there's a confusing lineout pin on
    NID 0x1b reported. Audio applications hence misunderstand that there
    are a speaker and a lineout, and take the lineout as the default audio
    output.

    Add a new quirk to remove the useless lineout and enable the pin 0x18
    for jack sensing and headset microphone.

    Signed-off-by: Chris Chiu
    Signed-off-by: Jian-Hong Pan
    Cc:
    Link: https://lore.kernel.org/r/20201216125200.27053-1-chiu@endlessos.org
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Chris Chiu
     
  • commit 6ca653e3f73a1af0f30dbf9c2c79d2897074989f upstream.

    The Quanta NL3 laptop has both a headphone output jack and a headset
    jack, on the right edge of the chassis.

    The pin information suggests that both of these are at the Front.
    The PulseAudio is confused to differentiate them so one of the jack
    can neither get the jack sense working nor the audio output.

    The ALC269_FIXUP_LIFEBOOK chained with ALC269_FIXUP_QUANTA_MUTE can
    help to differentiate 2 jacks and get the 'Auto-Mute Mode' working
    correctly.

    Signed-off-by: Chris Chiu
    Cc:
    Link: https://lore.kernel.org/r/20201222150459.9545-1-chiu@endlessos.org
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Chris Chiu
     
  • commit 09926202e939fd699650ac0fc0baa5757e069390 upstream.

    MSI-GP73 (with SSID 1462:1229) requires yet again
    ALC1220_FIXUP_CLEVO_P950 quirk like other MSI models.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210793
    Cc:
    Link: https://lore.kernel.org/r/20201220080943.24839-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 13be30f156fda725b168ac89fc91f78651575307 upstream.

    This Acer Veriton N4640G/N6640G/N2510G desktops have 2 headphone
    jacks(front and rear), and a separate Mic In jack.

    The rear headphone jack is actually a line out jack but always silent
    while playing audio. The front 'Mic In' also fails the jack sensing.
    Apply the ALC269_FIXUP_LIFEBOOK to have all audio jacks to work as
    expected.

    Signed-off-by: Chris Chiu
    Signed-off-by: Jian-Hong Pan
    Cc:
    Link: https://lore.kernel.org/r/20201222150459.9545-2-chiu@endlessos.org
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Chris Chiu
     
  • commit 11cb881bf075cea41092a20236ba708b18e1dbb2 upstream.

    There are a few places that call round{up|down}_pow_of_two() with the
    value zero, and this causes undefined behavior warnings. Avoid
    calling those macros if such a nonsense value is passed; it's a minor
    optimization as well, as we handle it as either an error or a value to
    be skipped, instead.

    Reported-by: syzbot+33ef0b6639a8d2d42b4c@syzkaller.appspotmail.com
    Cc:
    Link: https://lore.kernel.org/r/20201218161730.26596-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 607184cb1635eaee239fe3fb9648a8b82a5232d7 upstream.

    Add supported for more Lenovo ALC285 Headset Button.

    Signed-off-by: Kailang Yang
    Cc:
    Link: https://lore.kernel.org/r/bb1f1da1526d460885aa4257be81eb94@realtek.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Kailang Yang
     
  • commit 7e413528474d5895e3e315c019fb0c43522eb6d9 upstream.

    The ASUS laptop Q524UQK with ALC255 codec can't detect the headset
    microphone until ALC255_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.

    Signed-off-by: Chris Chiu
    Signed-off-by: Jian-Hong Pan
    Cc:
    Link: https://lore.kernel.org/r/20201209045730.9972-1-chiu@endlessos.org
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Chris Chiu
     
  • commit 5cfca59604e423f720297e30a9dc493eea623493 upstream.

    The ASUS laptop X430UN with ALC256 can't detect the headset microphone
    until ALC256_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.

    Signed-off-by: Chris Chiu
    Signed-off-by: Jian-Hong Pan
    Cc:
    Link: https://lore.kernel.org/r/20201207072755.16210-1-chiu@endlessos.org
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Chris Chiu
     
  • commit c72b9bfe0f914639cc475585f45722a3eb57a56d upstream.

    This change could fix 2 issues on this machine:
    - the bass speaker's output volume can't be adjusted, that is because
    the bass speaker is routed to the DAC (Nid 0x6) which has no volume
    control.
    - after plugging a headset with vol+, vol- and pause buttons on it,
    press those buttons, nothing happens, this means those buttons
    don't work at all. This machine has alc287 codec, need to add the
    codec id to the disable/enable_headset_jack_key(), then the headset
    button could work.

    The quirk of ALC285_FIXUP_THINKPAD_HEADSET_JACK could fix both of these
    2 issues.

    Cc:
    Signed-off-by: Hui Wang
    Link: https://lore.kernel.org/r/20201205051130.8122-1-hui.wang@canonical.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Hui Wang
     
  • commit c697ba85a94b8f65bf90dec5ef9af5c39c3e73b2 upstream.

    The Windows driver sets the pincfg for the AE-5's rear-headphone to
    report as a microphone. This causes issues with Pulseaudio mistakenly
    believing there is no headphone plugged in. In Linux, we should instead
    set it to be a headphone.

    Fixes: a6b0961b39896 ("ALSA: hda/ca0132 - fix AE-5 pincfg")
    Cc:
    Signed-off-by: Connor McAdams
    Link: https://lore.kernel.org/r/20201208195223.424753-1-conmanx360@gmail.com
    Link: https://lore.kernel.org/r/20201210173550.2968-1-conmanx360@gmail.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Connor McAdams
     
  • commit 2506318e382c4c7daa77bdc48f80a0ee82804588 upstream.

    It seems that the HD-audio clear and reconfig sysfs don't work any
    longer after the recent driver core change. There are multiple issues
    around that: the linked list corruption and the dead device handling.
    The former issue is fixed by another patch for the driver core itself,
    while the latter patch needs to be addressed in HD-audio side.

    This patch corresponds to the latter, it recovers those broken
    functions by replacing the device detach and attach actions with the
    standard core API functions, which are almost equivalent with unbind
    and bind actions.

    Fixes: 654888327e9f ("driver core: Avoid binding drivers to dead devices")
    Cc:
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209207
    Link: https://lore.kernel.org/r/20201209150119.7705-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit b08221c40febcbda9309dd70c61cf1b0ebb0e351 upstream.

    Recently we met a touchscreen problem on some Thinkpad machines, the
    touchscreen driver (i2c-hid) is not loaded and the touchscreen can't
    work.

    An i2c ACPI device with the name WACF2200 is defined in the BIOS, with
    the current rule in matching_id(), this device will be regarded as
    a PNP device since there is WACFXXX in the acpi_pnp_device_ids[] and
    this PNP device is attached to the acpi device as the 1st
    physical_node, this will make the i2c bus match fail when i2c bus
    calls acpi_companion_match() to match the acpi_id_table in the i2c-hid
    driver.

    WACF2200 is an i2c device instead of a PNP device, after adding the
    string length comparing, the matching_id() will return false when
    matching WACF2200 and WACFXXX, and it is reasonable to compare the
    string length when matching two IDs.

    Suggested-by: Rafael J. Wysocki
    Signed-off-by: Hui Wang
    Cc: All applicable
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Hui Wang
     
  • commit 12fc4dad94dfac25599f31257aac181c691ca96f upstream.

    This reverts commit 8a66790b7850a6669129af078768a1d42076a0ef.

    Switching this function to AE_CTRL_TERMINATE broke the documented
    behaviour of acpi_dev_get_resources() - AE_CTRL_TERMINATE does not, in
    fact, terminate the resource walk because acpi_walk_resource_buffer()
    ignores it (specifically converting it to AE_OK), referring to that
    value as "an OK termination by the user function". This means that
    acpi_dev_get_resources() does not abort processing when the preproc
    function returns a negative value.

    Signed-off-by: Daniel Scally
    Cc: 3.10+ # 3.10+
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Daniel Scally
     
  • commit 7482c5cb90e5a7f9e9e12dd154d405e0219656e3 upstream.

    The idea behind acpi_pm_set_bridge_wakeup() was to allow bridges to
    be reference counted for wakeup enabling, because they may be enabled
    to signal wakeup on behalf of their subordinate devices and that
    may happen for multiple times in a row, whereas for the other devices
    it only makes sense to enable wakeup signaling once.

    However, this becomes problematic if the bridge itself is suspended,
    because it is treated as a "regular" device in that case and the
    reference counting doesn't work.

    For instance, suppose that there are two devices below a bridge and
    they both can signal wakeup. Every time one of them is suspended,
    wakeup signaling is enabled for the bridge, so when they both have
    been suspended, the bridge's wakeup reference counter value is 2.

    Say that the bridge is suspended subsequently and acpi_pci_wakeup()
    is called for it. Because the bridge can signal wakeup, that
    function will invoke acpi_pm_set_device_wakeup() to configure it
    and __acpi_pm_set_device_wakeup() will be called with the last
    argument equal to 1. This causes __acpi_device_wakeup_enable()
    invoked by it to omit the reference counting, because the reference
    counter of the target device (the bridge) is 2 at that time.

    Now say that the bridge resumes and one of the device below it
    resumes too, so the bridge's reference counter becomes 0 and
    wakeup signaling is disabled for it, but there is still the other
    suspended device which may need the bridge to signal wakeup on its
    behalf and that is not going to work.

    To address this scenario, use wakeup enable reference counting for
    all devices, not just for bridges, so drop the last argument from
    __acpi_device_wakeup_enable() and __acpi_pm_set_device_wakeup(),
    which causes acpi_pm_set_device_wakeup() and
    acpi_pm_set_bridge_wakeup() to become identical, so drop the latter
    and use the former instead of it everywhere.

    Fixes: 1ba51a7c1496 ("ACPI / PCI / PM: Rework acpi_pci_propagate_wakeup()")
    Signed-off-by: Rafael J. Wysocki
    Reviewed-by: Mika Westerberg
    Acked-by: Bjorn Helgaas
    Cc: 4.14+ # 4.14+
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit 9a7e3d7f056831a6193d6d737fb7a26dfdceb04b upstream.

    Dan reports that smatch thinks userspace can craft an out-of-bound bus
    family number. However, nd_cmd_clear_to_send() blocks all non-zero
    values of bus-family since only the kernel can initiate these commands.
    However, in the speculation path, family is a user controlled array
    index value so mask it for speculation safety. Also, since the
    nd_cmd_clear_to_send() safety is non-obvious and possibly may change in
    the future include input validation as if userspace could get past the
    nd_cmd_clear_to_send() gatekeeper.

    Link: http://lore.kernel.org/r/20201111113000.GA1237157@mwanda
    Reported-by: Dan Carpenter
    Fixes: 6450ddbd5d8e ("ACPI: NFIT: Define runtime firmware activation commands")
    Cc:
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     
  • commit 7079f785b50055a32b72eddcb7d9ba5688db24d0 upstream.

    Change the Input Source enumerated control's strings to make it play
    nice with pulseaudio.

    Fixes: 7cb9d94c05de9 ("ALSA: hda/ca0132: add alt_select_in/out for R3Di + SBZ")
    Cc:
    Signed-off-by: Connor McAdams
    Link: https://lore.kernel.org/r/20201208195223.424753-2-conmanx360@gmail.com
    Link: https://lore.kernel.org/r/20201210173550.2968-2-conmanx360@gmail.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Connor McAdams
     
  • commit f051ae4f6c732c231046945b36234e977f8467c6 upstream.

    gcc -Warray-bounds warns about a serious bug in
    cyapa_pip_retrieve_data_structure:

    drivers/input/mouse/cyapa_gen6.c: In function 'cyapa_pip_retrieve_data_structure.constprop':
    include/linux/unaligned/access_ok.h:40:17: warning: array subscript -1 is outside array bounds of 'struct retrieve_data_struct_cmd[1]' [-Warray-bounds]
    40 | *((__le16 *)p) = cpu_to_le16(val);
    drivers/input/mouse/cyapa_gen6.c:569:13: note: while referencing 'cmd'
    569 | } __packed cmd;
    | ^~~

    Apparently the '-2' was added to the pointer instead of the value,
    writing garbage into the stack next to this variable.

    Fixes: c2c06c41f700 ("Input: cyapa - add gen6 device module support")
    Signed-off-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20201026161332.3708389-1-arnd@kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 219a8b9c04e54872f9a4d566633fb42f08bcbe2a upstream.

    The ipu3-cio2 doesn't make use of the field and this is reflected in V4L2
    buffers as well as the try format. Do this in active format, too.

    Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
    Signed-off-by: Sakari Ailus
    Reviewed-by: Bingbu Cao
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Laurent Pinchart
    Cc: stable@vger.kernel.org # v4.16 and up
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sakari Ailus
     
  • commit a86cf9b29e8b12811cf53c4970eefe0c1d290476 upstream.

    Validate media bus code, width and height when setting the subdev format.

    This effectively reworks how setting subdev format is implemented in the
    driver.

    Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
    Signed-off-by: Sakari Ailus
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Laurent Pinchart
    Cc: stable@vger.kernel.org # v4.16 and up
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sakari Ailus
     
  • commit 55a6c6b2be3d6670bf5772364d8208bd8dc17da4 upstream.

    Pad format can be accessed from user space. Serialise access to it.

    Fixes: c2a6a07afe4a ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
    Signed-off-by: Sakari Ailus
    Reviewed-by: Laurent Pinchart
    Reviewed-by: Bingbu Cao
    Reviewed-by: Andy Shevchenko
    Cc: stable@vger.kernel.org # v4.16 and up
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sakari Ailus