27 May, 2020

40 commits

  • commit a0b845ffa0d91855532b50fc040aeb2d8338dca4 upstream.

    aa_change_profile() invokes aa_get_current_label(), which returns
    a reference of the current task's label.

    According to the comment of aa_get_current_label(), the returned
    reference must be put with aa_put_label().
    However, when the original object pointed by "label" becomes
    unreachable because aa_change_profile() returns or a new object
    is assigned to "label", reference count increased by
    aa_get_current_label() is not decreased, causing a refcnt leak.

    Fix this by calling aa_put_label() before aa_change_profile() return
    and dropping unnecessary aa_get_current_label().

    Fixes: 9fcf78cca198 ("apparmor: update domain transitions that are subsets of confinement at nnp")
    Signed-off-by: Xiyu Yang
    Signed-off-by: Xin Tan
    Signed-off-by: John Johansen
    Signed-off-by: Greg Kroah-Hartman

    Xiyu Yang
     
  • commit c54d481d71c6849e044690d3960aaebc730224cc upstream.

    In the implementation of aa_audit_rule_init(), when aa_label_parse()
    fails the allocated memory for rule is released using
    aa_audit_rule_free(). But after this release, the return statement
    tries to access the label field of the rule which results in
    use-after-free. Before releasing the rule, copy errNo and return it
    after release.

    Fixes: 52e8c38001d8 ("apparmor: Fix memory leak of rule on error exit path")
    Signed-off-by: Navid Emamdoost
    Signed-off-by: John Johansen
    Signed-off-by: Greg Kroah-Hartman

    Navid Emamdoost
     
  • commit 40b697e256ccdb88aaff424b44b4d300eb8460e8 upstream.

    The GC860 has one GPU device which has a 2d and 3d core. In this case
    we want to expose perfmon information for both cores.

    The driver has one array which contains all possible perfmon domains
    with some meta data - doms_meta. Here we can see that for the GC860
    two elements of that array are relevant:

    doms_3d: is at index 0 in the doms_meta array with 8 perfmon domains
    doms_2d: is at index 1 in the doms_meta array with 1 perfmon domain

    The userspace driver wants to get a list of all perfmon domains and
    their perfmon signals. This is done by iterating over all domains and
    their signals. If the userspace driver wants to access the domain with
    id 8 the kernel driver fails and returns invalid data from doms_3d with
    and invalid offset.

    This results in:
    Unable to handle kernel paging request at virtual address 00000000

    On such a device it is not possible to use the userspace driver at all.

    The fix for this off-by-one error is quite simple.

    Reported-by: Paul Cercueil
    Tested-by: Paul Cercueil
    Fixes: ed1dd899baa3 ("drm/etnaviv: rework perfmon query infrastructure")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Gmeiner
    Signed-off-by: Lucas Stach
    Signed-off-by: Greg Kroah-Hartman

    Christian Gmeiner
     
  • commit 1cf6022bd9161081215028203919c33fcfa6debb upstream.

    Quoth the man page:
    ```
    If the tracee was restarted by PTRACE_SYSCALL or PTRACE_SYSEMU, the
    tracee enters syscall-enter-stop just prior to entering any system
    call (which will not be executed if the restart was using
    PTRACE_SYSEMU, regardless of any change made to registers at this
    point or how the tracee is restarted after this stop).
    ```

    The parenthetical comment is currently true on x86 and powerpc,
    but not currently true on arm64. arm64 re-checks the _TIF_SYSCALL_EMU
    flag after the syscall entry ptrace stop. However, at this point,
    it reflects which method was used to re-start the syscall
    at the entry stop, rather than the method that was used to reach it.
    Fix that by recording the original flag before performing the ptrace
    stop, bringing the behavior in line with documentation and x86/powerpc.

    Fixes: f086f67485c5 ("arm64: ptrace: add support for syscall emulation")
    Cc: # 5.3.x-
    Signed-off-by: Keno Fischer
    Acked-by: Will Deacon
    Tested-by: Sudeep Holla
    Tested-by: Bin Lu
    [catalin.marinas@arm.com: moved 'flags' bit masking]
    [catalin.marinas@arm.com: changed 'flags' type to unsigned long]
    Signed-off-by: Catalin Marinas
    Signed-off-by: Greg Kroah-Hartman

    Keno Fischer
     
  • commit f2e6b75f6ee82308ef7b00f29e71e5f1c6b3d52a upstream.

    Testing with Loopback I found that, after a Loopback LUN has executed a
    TMR, I can no longer unlink the LUN. The rm command hangs in
    transport_clear_lun_ref() at wait_for_completion(&lun->lun_shutdown_comp)
    The reason is, that transport_lun_remove_cmd() is not called at the end of
    target_tmr_work().

    It seems, that in other fabrics this call happens implicitly when the
    fabric drivers call transport_generic_free_cmd() during their
    ->queue_tm_rsp().

    Unfortunately Loopback seems to not comply to the common way
    of calling transport_generic_free_cmd() from ->queue_*().
    Instead it calls transport_generic_free_cmd() from its
    ->check_stop_free() only.

    But the ->check_stop_free() is called by
    transport_cmd_check_stop_to_fabric() after it has reset the se_cmd->se_lun
    pointer. Therefore the following transport_generic_free_cmd() skips the
    transport_lun_remove_cmd().

    So this patch re-adds the transport_lun_remove_cmd() at the end of
    target_tmr_work(), which was removed during commit 2c9fa49e100f ("scsi:
    target/core: Make ABORT and LUN RESET handling synchronous").

    For fabrics using transport_generic_free_cmd() in the usual way the double
    call to transport_lun_remove_cmd() doesn't harm, as
    transport_lun_remove_cmd() checks for this situation and does not release
    lun_ref twice.

    Link: https://lore.kernel.org/r/20200513153443.3554-1-bstroesser@ts.fujitsu.com
    Fixes: 2c9fa49e100f ("scsi: target/core: Make ABORT and LUN RESET handling synchronous")
    Cc: stable@vger.kernel.org
    Tested-by: Bryant G. Ly
    Reviewed-by: Bart van Assche
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Bodo Stroesser
     
  • commit fb9024b0646939e59d8a0b6799b317070619795a upstream.

    Calling ql_log() inside qla2x00_port_speed_show() is causing messages to be
    output to the console for no particularly good reason. The sysfs read
    routine should just return the information to userspace. The only reason
    to log a message is when the port speed actually changes, and this already
    occurs elsewhere.

    Link: https://lore.kernel.org/r/20200504175416.15417-1-emilne@redhat.com
    Fixes: 4910b524ac9e ("scsi: qla2xxx: Add support for setting port speed")
    Cc: # v5.1+
    Reviewed-by: Lee Duncan
    Reviewed-by: Laurence Oberman
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Ewan D. Milne
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    Ewan D. Milne
     
  • commit 259eb82475316672a5d682a94dc8bdd53cf8d8c3 upstream.

    A few known Clevo machines (PC50, PC70, X170) with ALC1220 codec need
    the existing quirk for pins for PB51 and co.

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

    PeiSen Hou
     
  • commit d9e8fe0cffbfdd18de96fa68ee2a8b667a0b046e upstream.

    The Gigabyte X570 Aorus Xtreme motherboard with ALC1220 codec
    requires a similar workaround for Clevo laptops to enforce the
    DAC/mixer connection path. Set up a quirk entry for that.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205275
    Signed-off-by: Christian Lachner
    Cc:
    Link: https://lore.kernel.org/r/20200518053844.42743-2-gladiac@gmail.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Christian Lachner
     
  • commit e7513c5786f8b33f0c107b3759e433bc6cbb2efa upstream.

    There is a corner case that ALSA keeps increasing the hw_ptr but DMA
    already stop working/updating the position for a long time.

    In following log we can see the position returned from DMA driver does
    not move at all but the hw_ptr got increased at some point of time so
    snd_pcm_avail() will return a large number which seems to be a buffer
    underrun event from user space program point of view. The program
    thinks there is space in the buffer and fill more data.

    [ 418.510086] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368
    [ 418.510149] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6910 avail 9554
    ...
    [ 418.681052] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362
    [ 418.681130] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
    [ 418.726515] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368

    This is because the hw_base will be increased by runtime->buffer_size
    frames unconditionally if the hw_ptr is not updated for over half of
    buffer time. As the hw_base increases, so does the hw_ptr increased
    by the same number.

    The avail value returned from snd_pcm_avail() could exceed the limit
    (buffer_size) easily becase the hw_ptr itself got increased by same
    buffer_size samples when the corner case happens. In following log,
    the buffer_size is 16368 samples but the avail is 21810 samples so
    CRAS server complains about it.

    [ 418.851755] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 27390 avail 5442
    [ 418.926491] sound pcmC0D5p: pos 96 hw_ptr 32832 appl_ptr 27390 avail 21810

    cras_server[1907]: pcm_avail returned frames larger than buf_size:
    sof-glkda7219max: :0,5: 21810 > 16368

    By updating runtime->hw_ptr_jiffies each time the HWSYNC is called,
    the hw_base will keep the same when buffer stall happens at long as
    the interval between each HWSYNC call is shorter than half of buffer
    time.

    Following is a log captured by a patched kernel. The hw_base/hw_ptr
    value is fixed in this corner case and user space program should be
    aware of the buffer stall and handle it.

    [ 293.525543] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368
    [ 293.525606] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6880 avail 9584
    [ 293.525975] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 10976 avail 5488
    [ 293.611178] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15072 avail 1392
    [ 293.696429] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
    ...
    [ 381.139517] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0

    Signed-off-by: Brent Lu
    Reviewed-by: Jaroslav Kysela
    Cc:
    Link: https://lore.kernel.org/r/1589776238-23877-1-git-send-email-brent.lu@intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Brent Lu
     
  • commit b0cb099062b0c18246c3a20caaab4c0afc303255 upstream.

    The ST Audio ADCIII is an STDSP24 card plus extension box. With commit
    e8a91ae18bdc ("ALSA: ice1712: Add support for STAudio ADCIII") we
    enabled the ADCIII ports using the model=staudio option but forgot
    this part to ensure the STDSP24 card is initialized properly.

    Fixes: e8a91ae18bdc ("ALSA: ice1712: Add support for STAudio ADCIII")
    Signed-off-by: Scott Bahling
    Cc:
    BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1048934
    Link: https://lore.kernel.org/r/20200518175728.28766-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Scott Bahling
     
  • commit 37486135d3a7b03acc7755b63627a130437f066a upstream.

    Though rdpkru and wrpkru are contingent upon CR4.PKE, the PKRU
    resource isn't. It can be read with XSAVE and written with XRSTOR.
    So, if we don't set the guest PKRU value here(kvm_load_guest_xsave_state),
    the guest can read the host value.

    In case of kvm_load_host_xsave_state, guest with CR4.PKE clear could
    potentially use XRSTOR to change the host PKRU value.

    While at it, move pkru state save/restore to common code and the
    host_pkru field to kvm_vcpu_arch. This will let SVM support protection keys.

    Cc: stable@vger.kernel.org
    Reported-by: Jim Mattson
    Signed-off-by: Babu Moger
    Message-Id:
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Greg Kroah-Hartman

    Babu Moger
     
  • [ Upstream commit 7900e81797613b92f855f9921392a7430cbdf88c ]

    The ASUS UX581LV laptop's audio (1043:19e1) with ALC295 can't detect the
    headset microphone until ALC295_FIXUP_ASUS_MIC_NO_PRESENCE quirk
    applied.

    Signed-off-by: Jian-Hong Pan
    Link: https://lore.kernel.org/r/20200512061525.133985-3-jian-hong@endlessm.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Jian-Hong Pan
     
  • [ Upstream commit ad97d667854c2fbce05a004e107f358ef4b04cf6 ]

    The ASUS laptop UX550GE with ALC295 can't detect the headset microphone
    until ALC295_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.

    Signed-off-by: Jian-Hong Pan
    Signed-off-by: Daniel Drake
    Link: https://lore.kernel.org/r/20200512061525.133985-2-jian-hong@endlessm.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Jian-Hong Pan
     
  • [ Upstream commit 9e43342b464f1de570a3ad8256ac77645749ef45 ]

    The ASUS laptop GL503VM with ALC295 can't detect the headset microphone.
    The headset microphone does not work until pin 0x19 is enabled for it.

    Signed-off-by: Chris Chiu
    Signed-off-by: Daniel Drake
    Signed-off-by: Jian-Hong Pan
    Link: https://lore.kernel.org/r/20200512061525.133985-1-jian-hong@endlessm.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Chris Chiu
     
  • [ Upstream commit 14425f1f521fdfe274a7bb390637c786432e08b4 ]

    Some models of the Samsung Notebook 9 have very quiet and distorted
    headphone output. This quirk changes the VREF value of the ALC298
    codec NID 0x1a from default HIZ to new 100.

    [ adjusted to 5.7-base and rearranged in SSID order -- tiwai ]

    Signed-off-by: Mike Pozulp
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207423
    Link: https://lore.kernel.org/r/20200510032838.1989130-1-pozulp.kernel@gmail.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Mike Pozulp
     
  • [ Upstream commit 24164f434dc9c23cd34fca1e36acea9d0581bdde ]

    HP new platform has new mute led feature.
    COEF index 0x34 bit 5 to control playback mute led.
    COEF index 0x35 bit 2 and bit 3 to control Mic mute led.

    [ corrected typos by tiwai ]

    Signed-off-by: Kailang Yang
    Link: https://lore.kernel.org/r/6741211598ba499687362ff2aa30626b@realtek.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Kailang Yang
     
  • [ Upstream commit 431e76c3edd76d84a0ed1eb81a286b2ddecc5ee4 ]

    HP Note Book supported new mute Led.
    Hardware PIN was not enough to meet old LED rule.
    JD2 to control playback mute led.
    GPO3 to control capture mute led.
    (ALC285 didn't control GPO3 via verb command)
    This two PIN just could control by COEF registers.

    [ corrected typos by tiwai ]

    Signed-off-by: Kailang Yang
    Link: https://lore.kernel.org/r/6741211598ba499687362ff2aa30626b@realtek.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Kailang Yang
     
  • [ Upstream commit 1a462be52f4505a2719631fb5aa7bfdbd37bfd8d ]

    In the commit 8e85def5723e ("ALSA: hda: enable regmap internal
    locking"), we re-enabled the regmap lock due to the reported
    regression that showed the possible concurrent accesses. It was a
    temporary workaround, and there are still a few opened races even
    after the revert. In this patch, we cover those still opened windows
    with a proper mutex lock and disable the regmap internal lock again.

    First off, the patch introduces a new snd_hdac_device.regmap_lock
    mutex that is applied for each snd_hdac_regmap_*() call, including
    read, write and update helpers. The mutex is applied carefully so
    that it won't block the self-power-up procedure in the helper
    function. Also, this assures the protection for the accesses without
    regmap, too.

    The snd_hdac_regmap_update_raw() is refactored to use the standard
    regmap_update_bits_check() function instead of the open-code. The
    non-regmap case is still open-coded but it's an easy part. The all
    read and write operations are in the single mutex protection, so it's
    now race-free.

    In addition, a couple of new helper functions are added:
    snd_hdac_regmap_update_raw_once() and snd_hdac_regmap_sync(). Both
    are called from HD-audio legacy driver. The former is to initialize
    the given verb bits but only once when it's not initialized yet. Due
    to this condition, the function invokes regcache_cache_only(), and
    it's now performed inside the regmap_lock (formerly it was racy) too.
    The latter function is for simply invoking regcache_sync() inside the
    regmap_lock, which is called from the codec resume call path.
    Along with that, the HD-audio codec driver code is slightly modified /
    simplified to adapt those new functions.

    And finally, snd_hdac_regmap_read_raw(), *_write_raw(), etc are
    rewritten with the helper macro. It's just for simplification because
    the code logic is identical among all those functions.

    Tested-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200109090104.26073-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Takashi Iwai
     
  • [ Upstream commit 8a71821f12a010d7100f9cc1f7b218aff0313c4a ]

    GCC reports the following warning with W=1

    sound/pci/hda/patch_realtek.c: In function ‘alc269_suspend’:
    sound/pci/hda/patch_realtek.c:3616:29: warning: suggest braces around
    empty body in an ‘if’ statement [-Wempty-body]
    3616 | alc5505_dsp_suspend(codec);
    | ^

    sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:
    sound/pci/hda/patch_realtek.c:3651:28: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
    3651 | alc5505_dsp_resume(codec);
    | ^

    This is a classic macro problem and can indeed lead to bad program
    flows.

    Fix by using the usual "do { } while (0)" pattern

    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200111214736.3002-2-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Pierre-Louis Bossart
     
  • [ Upstream commit caf3c0437aaf2e63624c4aaf94c0dd38d1f897e3 ]

    Make hda_nid_t tables static const, as they are not intended to be
    modified by callees.

    Signed-off-by: Michał Mirosław
    Link: https://lore.kernel.org/r/5150c94101c9534f4c8e987324f6912c16d459f6.1578043216.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin

    Michał Mirosław
     
  • [ Upstream commit 50e36be1fb9572b2e4f2753340bdce3116bf2ce7 ]

    The current implementations of the rb_first() and rb_last() gdb
    functions have a variable that references itself in its instanciation,
    which causes the function to throw an error if a specific condition on
    the argument is met. The original author rather intended to reference
    the argument and made a typo. Referring the argument instead makes the
    function work as intended.

    Signed-off-by: Aymeric Agon-Rambosson
    Signed-off-by: Andrew Morton
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Jackie Liu
    Cc: Jason Wessel
    Link: http://lkml.kernel.org/r/20200427051029.354840-1-aymeric.agon@yandex.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Aymeric Agon-Rambosson
     
  • [ Upstream commit 8101b5a1531f3390b3a69fa7934c70a8fd6566ad ]

    Stephen reported the following build warning on a ARM multi_v7_defconfig
    build with GCC 9.2.1:

    kernel/futex.c: In function 'do_futex':
    kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
    1676 | return oldval == cmparg;
    | ~~~~~~~^~~~~~~~~
    kernel/futex.c:1652:6: note: 'oldval' was declared here
    1652 | int oldval, ret;
    | ^~~~~~

    introduced by commit a08971e9488d ("futex: arch_futex_atomic_op_inuser()
    calling conventions change").

    While that change should not make any difference it confuses GCC which
    fails to work out that oldval is not referenced when the return value is
    not zero.

    GCC fails to properly analyze arch_futex_atomic_op_inuser(). It's not the
    early return, the issue is with the assembly macros. GCC fails to detect
    that those either set 'ret' to 0 and set oldval or set 'ret' to -EFAULT
    which makes oldval uninteresting. The store to the callsite supplied oldval
    pointer is conditional on ret == 0.

    The straight forward way to solve this is to make the store unconditional.

    Aside of addressing the build warning this makes sense anyway because it
    removes the conditional from the fastpath. In the error case the stored
    value is uninteresting and the extra store does not matter at all.

    Reported-by: Stephen Rothwell
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/87pncao2ph.fsf@nanos.tec.linutronix.de
    Signed-off-by: Sasha Levin

    Thomas Gleixner
     
  • [ Upstream commit 8ffdaf9155ebe517cdec5edbcca19ba6e7ee9c3c ]

    I got this error when building kvm selftests:

    /usr/bin/ld: /home/xz/git/linux/tools/testing/selftests/kvm/libkvm.a(vmx.o):/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:222: multiple definition of `current_evmcs'; /tmp/cco1G48P.o:/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:222: first defined here
    /usr/bin/ld: /home/xz/git/linux/tools/testing/selftests/kvm/libkvm.a(vmx.o):/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:223: multiple definition of `current_vp_assist'; /tmp/cco1G48P.o:/home/xz/git/linux/tools/testing/selftests/kvm/include/evmcs.h:223: first defined here

    I think it's because evmcs.h is included both in a test file and a lib file so
    the structs have multiple declarations when linking. After all it's not a good
    habit to declare structs in the header files.

    Cc: Vitaly Kuznetsov
    Signed-off-by: Peter Xu
    Message-Id:
    Signed-off-by: Paolo Bonzini
    Signed-off-by: Sasha Levin

    Peter Xu
     
  • [ Upstream commit e6142dd511425cb827b5db869f489eb81f5f994d ]

    [why]
    During hotplug, a DP port may be connected to the sink through
    passive adapter which does not support DPCD reads. Issuing reads
    without checking for this condition will result in errors

    [how]
    Ensure the link is in aux_mode before initiating operation that result
    in a DPCD read.

    Signed-off-by: Aurabindo Pillai
    Reviewed-by: Harry Wentland
    Acked-by: Aurabindo Pillai
    Signed-off-by: Alex Deucher
    Signed-off-by: Sasha Levin

    Aurabindo Pillai
     
  • [ Upstream commit f44a4d7e4f1cdef73c90b1dc749c4d8a7372a8eb ]

    The update_domain() function is expected to also inform the hardware
    about domain changes. This needs a COMPLETION_WAIT command to be sent
    to all IOMMUs which use the domain.

    Signed-off-by: Joerg Roedel
    Tested-by: Qian Cai
    Link: https://lore.kernel.org/r/20200504125413.16798-4-joro@8bytes.org
    Signed-off-by: Joerg Roedel
    Signed-off-by: Sasha Levin

    Joerg Roedel
     
  • [ Upstream commit 3bd12da7f50b8bc191fcb3bab1f55c582234df59 ]

    asus-nb-wmi does not add any extra functionality on these Asus
    Transformer books. They have detachable keyboards, so the hotkeys are
    send through a HID device (and handled by the hid-asus driver) and also
    the rfkill functionality is not used on these devices.

    Besides not adding any extra functionality, initializing the WMI interface
    on these devices actually has a negative side-effect. For some reason
    the \_SB.ATKD.INIT() function which asus_wmi_platform_init() calls drives
    GPO2 (INT33FC:02) pin 8, which is connected to the front facing webcam LED,
    high and there is no (WMI or other) interface to drive this low again
    causing the LED to be permanently on, even during suspend.

    This commit adds a blacklist of DMI system_ids on which not to load the
    asus-nb-wmi and adds these Transformer books to this list. This fixes
    the webcam LED being permanently on under Linux.

    Signed-off-by: Hans de Goede
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Sasha Levin

    Hans de Goede
     
  • [ Upstream commit ac854131d9844f79e2fdcef67a7707227538d78a ]

    The syzbot fuzzer found a race between URB submission to endpoint 0
    and device reset. Namely, during the reset we call usb_ep0_reinit()
    because the characteristics of ep0 may have changed (if the reset
    follows a firmware update, for example). While usb_ep0_reinit() is
    running there is a brief period during which the pointers stored in
    udev->ep_in[0] and udev->ep_out[0] are set to NULL, and if an URB is
    submitted to ep0 during that period, usb_urb_ep_type_check() will
    report it as a driver bug. In the absence of those pointers, the
    routine thinks that the endpoint doesn't exist. The log message looks
    like this:

    ------------[ cut here ]------------
    usb 2-1: BOGUS urb xfer, pipe 2 != type 2
    WARNING: CPU: 0 PID: 9241 at drivers/usb/core/urb.c:478
    usb_submit_urb+0x1188/0x1460 drivers/usb/core/urb.c:478

    Now, although submitting an URB while the device is being reset is a
    questionable thing to do, it shouldn't count as a driver bug as severe
    as submitting an URB for an endpoint that doesn't exist. Indeed,
    endpoint 0 always exists, even while the device is in its unconfigured
    state.

    To prevent these misleading driver bug reports, this patch updates
    usb_disable_endpoint() to avoid clearing the ep_in[] and ep_out[]
    pointers when the endpoint being disabled is ep0. There's no danger
    of leaving a stale pointer in place, because the usb_host_endpoint
    structure being pointed to is stored permanently in udev->ep0; it
    doesn't get deallocated until the entire usb_device structure does.

    Reported-and-tested-by: syzbot+db339689b2101f6f6071@syzkaller.appspotmail.com
    Signed-off-by: Alan Stern

    Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2005011558590.903-100000@netrider.rowland.org
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Alan Stern
     
  • [ Upstream commit f42234ffd531ca6b13d9da02faa60b72eccf8334 ]

    The paranoidal pointer check in IRQ handler looks very strange - it
    really protects us only against bogus drivers which request IRQ line
    with null pointer dev_id. However, the code fragment is incorrect
    because the dev pointer is used before the actual check which leads
    to undefined behavior. Remove the check to avoid confusing people
    with incorrect code.

    Signed-off-by: Maxim Petrov
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Maxim Petrov
     
  • [ Upstream commit 4d8e28ff3106b093d98bfd2eceb9b430c70a8758 ]

    If the ceph_mdsc_open_export_target_session() return fails, it will
    do a "goto retry", but the session mutex has already been unlocked.
    Re-lock the mutex in that case to ensure that we don't unlock it
    twice.

    Signed-off-by: Wu Bo
    Reviewed-by: "Yan, Zheng"
    Signed-off-by: Ilya Dryomov
    Signed-off-by: Sasha Levin

    Wu Bo
     
  • [ Upstream commit 1e189f267015a098bdcb82cc652d13fbf2203fa0 ]

    Add a HID_QUIRK_NO_INIT_REPORTS quirk for the Dell K12A keyboard-dock,
    which can be used with various Dell Venue 11 models.

    Without this quirk the keyboard/touchpad combo works fine when connected
    at boot, but when hotplugged 9 out of 10 times it will not work properly.
    Adding the quirk fixes this.

    Cc: Mario Limonciello
    Signed-off-by: Hans de Goede
    Signed-off-by: Jiri Kosina
    Signed-off-by: Sasha Levin

    Hans de Goede
     
  • [ Upstream commit 846c68f7f1ac82c797a2f1db3344a2966c0fe2e1 ]

    In drivers/net/gtp.c, gtp_genl_dump_pdp() should set NLM_F_MULTI
    flag since it returns multipart message.
    This patch adds a new arg "flags" in gtp_genl_fill_info() so that
    flags can be set by the callers.

    Signed-off-by: Yoshiyuki Kurauchi
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Yoshiyuki Kurauchi
     
  • [ Upstream commit c84cb3735fd53c91101ccdb191f2e3331a9262cb ]

    Leon reported that the printk_once() in __setup_APIC_LVTT() triggers a
    lockdep splat due to a lock order violation between hrtimer_base::lock and
    console_sem, when the 'once' condition is reset via
    /sys/kernel/debug/clear_warn_once after boot.

    The initial printk cannot trigger this because that happens during boot
    when the local APIC timer is set up on the boot CPU.

    Prevent it by moving the printk to a place which is guaranteed to be only
    called once during boot.

    Mark the deadline timer check related functions and data __init while at
    it.

    Reported-by: Leon Romanovsky
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/87y2qhoshi.fsf@nanos.tec.linutronix.de
    Signed-off-by: Sasha Levin

    Thomas Gleixner
     
  • [ Upstream commit b730d668138cb3dd9ce78f8003986d1adae5523a ]

    Currently, ftracetest will return 1 (failure) if any unresolved cases
    are encountered. The unresolved status results from modules and
    programs not being available, and as such does not indicate any
    issues with ftrace itself. As such, change the behaviour of
    ftracetest in line with unsupported cases; if unsupported cases
    happen, ftracetest still returns 0 unless --fail-unsupported. Here
    --fail-unresolved is added and the default is to return 0 if
    unresolved results occur.

    Signed-off-by: Alan Maguire
    Acked-by: Masami Hiramatsu
    Acked-by: Steven Rostedt (VMware)
    Signed-off-by: Shuah Khan
    Signed-off-by: Sasha Levin

    Alan Maguire
     
  • [ Upstream commit f9c6cea0b38518741c8dcf26ac056d26ee2fd61d ]

    During MTU change, the following events may happen.
    Client-driven CRQ initialization fails due to partner’s CRQ closed,
    causing client to enqueue a reset task for FATAL_ERROR. Then passive
    (server-driven) CRQ initialization succeeds, causing client to
    release CRQ and enqueue a reset task for failover. If the passive
    CRQ initialization occurs before the FATAL reset task is processed,
    the FATAL error reset task would try to access a CRQ message queue
    that was freed, causing an oops. The problem may be most likely to
    occur during DLPAR add vNIC with a non-default MTU, because the DLPAR
    process will automatically issue a change MTU request.

    Fix this by not processing fatal error reset if CRQ is passively
    initialized after client-driven CRQ initialization fails.

    Signed-off-by: Juliet Kim
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Juliet Kim
     
  • [ Upstream commit ab5130186d7476dcee0d4e787d19a521ca552ce9 ]

    As an optimization, cpa_flush() was changed to optionally only flush
    the range in @cpa if it was small enough. However, this range does
    not include any direct map aliases changed in cpa_process_alias(). So
    small set_memory_() calls that touch that alias don't get the direct
    map changes flushed. This situation can happen when the virtual
    address taking variants are passed an address in vmalloc or modules
    space.

    In these cases, force a full TLB flush.

    Note this issue does not extend to cases where the set_memory_() calls are
    passed a direct map address, or page array, etc, as the primary target. In
    those cases the direct map would be flushed.

    Fixes: 935f5839827e ("x86/mm/cpa: Optimize cpa_flush_array() TLB invalidation")
    Signed-off-by: Rick Edgecombe
    Signed-off-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20200424105343.GA20730@hirez.programming.kicks-ass.net
    Signed-off-by: Sasha Levin

    Rick Edgecombe
     
  • [ Upstream commit 538f67407e2c0e5ed2a46e7d7ffa52f2e30c7ef8 ]

    On the Dell XPS 9570, the Synaptics SYNA2393 touchpad generates spurious
    interrupts after resuming from suspend until it receives some input or
    is reset. Add it to the quirk I2C_HID_QUIRK_RESET_ON_RESUME so that it
    is reset when resuming from suspend.

    More information about the bug can be found in this mailing list
    discussion: https://www.spinics.net/lists/linux-input/msg59530.html

    Signed-off-by: Daniel Playfair Cal
    Signed-off-by: Jiri Kosina
    Signed-off-by: Sasha Levin

    Daniel Playfair Cal
     
  • [ Upstream commit b36522150e5b85045f868768d46fbaaa034174b2 ]

    While removing an ibmvscsi client adapter a WARN_ON like the following is
    seen in the kernel log:

    drmgr: drmgr: -r -c slot -s U9080.M9S.783AEC8-V11-C11 -w 5 -d 1
    WARNING: CPU: 9 PID: 24062 at ../kernel/dma/mapping.c:311 dma_free_attrs+0x78/0x110
    Supported: No, Unreleased kernel
    CPU: 9 PID: 24062 Comm: drmgr Kdump: loaded Tainted: G X 5.3.18-12-default
    NIP: c0000000001fa758 LR: c0000000001fa744 CTR: c0000000001fa6e0
    REGS: c0000002173375d0 TRAP: 0700 Tainted: G X (5.3.18-12-default)
    MSR: 8000000000029033 CR: 28088282 XER: 20000000
    CFAR: c0000000001fbf0c IRQMASK: 1
    GPR00: c0000000001fa744 c000000217337860 c00000000161ab00 0000000000000000
    GPR04: 0000000000000000 c000011e12250000 0000000018010000 0000000000000000
    GPR08: 0000000000000000 0000000000000001 0000000000000001 c0080000190f4fa8
    GPR12: c0000000001fa6e0 c000000007fc2a00 0000000000000000 0000000000000000
    GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    GPR24: 000000011420e310 0000000000000000 0000000000000000 0000000018010000
    GPR28: c00000000159de50 c000011e12250000 0000000000006600 c000011e5c994848
    NIP [c0000000001fa758] dma_free_attrs+0x78/0x110
    LR [c0000000001fa744] dma_free_attrs+0x64/0x110
    Call Trace:
    [c000000217337860] [000000011420e310] 0x11420e310 (unreliable)
    [c0000002173378b0] [c0080000190f0280] release_event_pool+0xd8/0x120 [ibmvscsi]
    [c000000217337930] [c0080000190f3f74] ibmvscsi_remove+0x6c/0x160 [ibmvscsi]
    [c000000217337960] [c0000000000f3cac] vio_bus_remove+0x5c/0x100
    [c0000002173379a0] [c00000000087a0a4] device_release_driver_internal+0x154/0x280
    [c0000002173379e0] [c0000000008777cc] bus_remove_device+0x11c/0x220
    [c000000217337a60] [c000000000870fc4] device_del+0x1c4/0x470
    [c000000217337b10] [c0000000008712a0] device_unregister+0x30/0xa0
    [c000000217337b80] [c0000000000f39ec] vio_unregister_device+0x2c/0x60
    [c000000217337bb0] [c00800001a1d0964] dlpar_remove_slot+0x14c/0x250 [rpadlpar_io]
    [c000000217337c50] [c00800001a1d0bcc] remove_slot_store+0xa4/0x110 [rpadlpar_io]
    [c000000217337cd0] [c000000000c091a0] kobj_attr_store+0x30/0x50
    [c000000217337cf0] [c00000000057c934] sysfs_kf_write+0x64/0x90
    [c000000217337d10] [c00000000057be10] kernfs_fop_write+0x1b0/0x290
    [c000000217337d60] [c000000000488c4c] __vfs_write+0x3c/0x70
    [c000000217337d80] [c00000000048c648] vfs_write+0xd8/0x260
    [c000000217337dd0] [c00000000048ca8c] ksys_write+0xdc/0x130
    [c000000217337e20] [c00000000000b488] system_call+0x5c/0x70
    Instruction dump:
    7c840074 f8010010 f821ffb1 20840040 eb830218 7c8407b4 48002019 60000000
    2fa30000 409e003c 892d0988 792907e0 2fbd0000 419e0028 2fbc0000
    ---[ end trace 5955b3c0cc079942 ]---
    rpadlpar_io: slot U9080.M9S.783AEC8-V11-C11 removed

    This is tripped as a result of irqs being disabled during the call to
    dma_free_coherent() by release_event_pool(). At this point in the code path
    we have quiesced the adapter and it is overly paranoid to be holding the
    host lock.

    [mkp: fixed build warning reported by sfr]

    Link: https://lore.kernel.org/r/1588027793-17952-1-git-send-email-tyreld@linux.ibm.com
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Tyrel Datwyler
     
  • [ Upstream commit caec66198d137c26f0d234abc498866a58c64150 ]

    This fixes the following build warning in ena_xdp_set(), which is
    observed on aarch64 with 64KB page size.

    In file included from ./include/net/inet_sock.h:19,
    from ./include/net/ip.h:27,
    from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
    drivers/net/ethernet/amazon/ena/ena_netdev.c: In function \
    ‘ena_xdp_set’: \
    drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning: \
    format ‘%lu’ \
    expects argument of type ‘long unsigned int’, but argument 4 \
    has type ‘int’ \
    [-Wformat=] "Failed to set xdp program, the current MTU (%d) is \
    larger than the maximum allowed MTU (%lu) while xdp is on",

    Signed-off-by: Gavin Shan
    Acked-by: Shay Agroskin
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Gavin Shan
     
  • [ Upstream commit 7706b0a76a9697021e2bf395f3f065c18f51043d ]

    If a component fails to bind due to -EPROBE_DEFER we should not log an
    error as this is not a real failure.

    Fixes messages like:
    vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517
    vc4-drm soc:gpu: master bind failed: -517

    Signed-off-by: James Hilliard
    Link: https://lore.kernel.org/r/20200411190241.89404-1-james.hilliard1@gmail.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    James Hilliard
     
  • [ Upstream commit 6de556c31061e3b9c36546ffaaac5fdb679a2f14 ]

    The Aquantia AQC100 controller enables a SFP+ port, so the driver should
    configure the media type as '_TYPE_FIBRE' instead of '_TYPE_TP'.

    Signed-off-by: Richard Clark
    Cc: Igor Russkikh
    Cc: "David S. Miller"
    Acked-by: Igor Russkikh
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Richard Clark