05 Aug, 2020

40 commits

  • [ Upstream commit 1748f6a2cbc4694523f16da1c892b59861045b9d ]

    The rcu_dereference call in rht_ptr_rcu is completely bogus because
    we've already dereferenced the value in __rht_ptr and operated on it.
    This causes potential double readings which could be fatal. The RCU
    dereference must occur prior to the comparison in __rht_ptr.

    This patch changes the order of RCU dereference so that it is done
    first and the result is then fed to __rht_ptr. The RCU marking
    changes have been minimised using casts which will be removed in
    a follow-up patch.

    Fixes: ba6306e3f648 ("rhashtable: Remove RCU marking from...")
    Reported-by: "Gong, Sishuai"
    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Herbert Xu
     
  • [ Upstream commit 63634aa679ba8b5e306ad0727120309ae6ba8a8e ]

    The interrupt URB transfer-buffer was never freed on disconnect or after
    probe errors.

    Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
    Cc: Woojung.Huh@microchip.com
    Signed-off-by: Johan Hovold
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Johan Hovold
     
  • [ Upstream commit 8d8e95fd6d69d774013f51e5f2ee10c6e6d1fc14 ]

    Add the missing endpoint sanity check to prevent a NULL-pointer
    dereference should a malicious device lack the expected endpoints.

    Note that the driver has a broken endpoint-lookup helper,
    lan78xx_get_endpoints(), which can end up accepting interfaces in an
    altsetting without endpoints as long as *some* altsetting has a bulk-in
    and a bulk-out endpoint.

    Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
    Cc: Woojung.Huh@microchip.com
    Signed-off-by: Johan Hovold
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Johan Hovold
     
  • [ Upstream commit 350a63249d270b1f5bd05c7e2a24cd8de0f9db20 ]

    After the cited commit, function 'mlx5_eswitch_set_vport_vlan' started
    to acquire esw->state_lock.
    However, esw is not defined for VF devices, hence attempting to set vf
    VLANID on a VF dev will cause a kernel panic.

    Fix it by moving up the (redundant) esw validation from function
    '__mlx5_eswitch_set_vport_vlan' since the rest of the callers now have
    and use a valid esw.

    For example with vf device eth4:
    # ip link set dev eth4 vf 0 vlan 0

    Trace of the panic:
    [ 411.409842] BUG: unable to handle page fault for address: 00000000000011b8
    [ 411.449745] #PF: supervisor read access in kernel mode
    [ 411.452348] #PF: error_code(0x0000) - not-present page
    [ 411.454938] PGD 80000004189c9067 P4D 80000004189c9067 PUD 41899a067 PMD 0
    [ 411.458382] Oops: 0000 [#1] SMP PTI
    [ 411.460268] CPU: 4 PID: 5711 Comm: ip Not tainted 5.8.0-rc4_for_upstream_min_debug_2020_07_08_22_04 #1
    [ 411.462447] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
    [ 411.464158] RIP: 0010:__mutex_lock+0x4e/0x940
    [ 411.464928] Code: fd 41 54 49 89 f4 41 52 53 89 d3 48 83 ec 70 44 8b 1d ee 03 b0 01 65 48 8b 04 25 28 00 00 00 48 89 45 c8 31 c0 45 85 db 75 0a 3b 7f 60 0f 85 7e 05 00 00 49 8d 45 68 41 56 41 b8 01 00 00 00
    [ 411.467678] RSP: 0018:ffff88841fcd74b0 EFLAGS: 00010246
    [ 411.468562] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
    [ 411.469715] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000001158
    [ 411.470812] RBP: ffff88841fcd7550 R08: ffffffffa00fa1ce R09: 0000000000000000
    [ 411.471835] R10: ffff88841fcd7570 R11: 0000000000000000 R12: 0000000000000002
    [ 411.472862] R13: 0000000000001158 R14: ffffffffa00fa1ce R15: 0000000000000000
    [ 411.474004] FS: 00007faee7ca6b80(0000) GS:ffff88846fc00000(0000) knlGS:0000000000000000
    [ 411.475237] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 411.476129] CR2: 00000000000011b8 CR3: 000000041909c006 CR4: 0000000000360ea0
    [ 411.477260] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 411.478340] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [ 411.479332] Call Trace:
    [ 411.479760] ? __nla_validate_parse.part.6+0x57/0x8f0
    [ 411.482825] ? mlx5_eswitch_set_vport_vlan+0x3e/0xa0 [mlx5_core]
    [ 411.483804] mlx5_eswitch_set_vport_vlan+0x3e/0xa0 [mlx5_core]
    [ 411.484733] mlx5e_set_vf_vlan+0x41/0x50 [mlx5_core]
    [ 411.485545] do_setlink+0x613/0x1000
    [ 411.486165] __rtnl_newlink+0x53d/0x8c0
    [ 411.486791] ? mark_held_locks+0x49/0x70
    [ 411.487429] ? __lock_acquire+0x8fe/0x1eb0
    [ 411.488085] ? rcu_read_lock_sched_held+0x52/0x60
    [ 411.488998] ? kmem_cache_alloc_trace+0x16d/0x2d0
    [ 411.489759] rtnl_newlink+0x47/0x70
    [ 411.490357] rtnetlink_rcv_msg+0x24e/0x450
    [ 411.490978] ? netlink_deliver_tap+0x92/0x3d0
    [ 411.491631] ? validate_linkmsg+0x330/0x330
    [ 411.492262] netlink_rcv_skb+0x47/0x110
    [ 411.492852] netlink_unicast+0x1ac/0x270
    [ 411.493551] netlink_sendmsg+0x336/0x450
    [ 411.494209] sock_sendmsg+0x30/0x40
    [ 411.494779] ____sys_sendmsg+0x1dd/0x1f0
    [ 411.495378] ? copy_msghdr_from_user+0x5c/0x90
    [ 411.496082] ___sys_sendmsg+0x87/0xd0
    [ 411.496683] ? lock_acquire+0xb9/0x3a0
    [ 411.497322] ? lru_cache_add+0x5/0x170
    [ 411.497944] ? find_held_lock+0x2d/0x90
    [ 411.498568] ? handle_mm_fault+0xe46/0x18c0
    [ 411.499205] ? __sys_sendmsg+0x51/0x90
    [ 411.499784] __sys_sendmsg+0x51/0x90
    [ 411.500341] do_syscall_64+0x59/0x2e0
    [ 411.500938] ? asm_exc_page_fault+0x8/0x30
    [ 411.501609] ? rcu_read_lock_sched_held+0x52/0x60
    [ 411.502350] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 411.503093] RIP: 0033:0x7faee73b85a7
    [ 411.503654] Code: Bad RIP value.

    Fixes: 0e18134f4f9f ("net/mlx5e: Eswitch, use state_lock to synchronize vlan change")
    Signed-off-by: Alaa Hleihel
    Reviewed-by: Roi Dayan
    Reviewed-by: Vlad Buslov
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin

    Alaa Hleihel
     
  • [ Upstream commit 7d0314b11cdd92bca8b89684c06953bf114605fc ]

    When setting the PF interface up/down, notify the firmware to update
    uplink state via MODIFY_VPORT_STATE, when E-Switch is enabled.

    This behavior will prevent sending traffic out on uplink port when PF is
    down, such as sending traffic from a VF interface which is still up.
    Currently when calling mlx5e_open/close(), the driver only sends PAOS
    command to notify the firmware to set the physical port state to
    up/down, however, it is not sufficient. When VF is in "auto" state, it
    follows the uplink state, which was not updated on mlx5e_open/close()
    before this patch.

    When switchdev mode is enabled and uplink representor is first enabled,
    set the uplink port state value back to its FW default "AUTO".

    Fixes: 63bfd399de55 ("net/mlx5e: Send PAOS command on interface up/down")
    Signed-off-by: Ron Diskin
    Reviewed-by: Roi Dayan
    Reviewed-by: Moshe Shemesh
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin

    Ron Diskin
     
  • [ Upstream commit 071995c877a8646209d55ff8edddd2b054e7424c ]

    Fix a bug where driver did not verify Hardware pin capabilities for
    PTP functions.

    Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support")
    Signed-off-by: Eran Ben Elisha
    Reviewed-by: Ariel Levkovich
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin

    Eran Ben Elisha
     
  • [ Upstream commit 5cd39b6e9a420329a9a408894be7ba8aa7dd755e ]

    On failure to attach the netdev, fix the rollback by re-setting the
    device's state back to MLX5E_STATE_DESTROYING.

    Failing to attach doesn't stop statistics polling via .ndo_get_stats64.
    In this case, although the device is not attached, it falsely continues
    to query the firmware for counters. Setting the device's state back to
    MLX5E_STATE_DESTROYING prevents the firmware counters query.

    Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks")
    Signed-off-by: Aya Levin
    Reviewed-by: Tariq Toukan
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin

    Aya Levin
     
  • [ Upstream commit 2b8e9c7c3fd0e31091edb1c66cc06ffe4988ca21 ]

    When either esw_legacy_enable() or esw_offloads_enable() fails,
    code missed to destroy the created TSAR.

    Hence, add the missing call to destroy the TSAR.

    Fixes: 610090ebce92 ("net/mlx5: E-switch, Initialize TSAR Qos hardware block before its user vports")
    Signed-off-by: Parav Pandit
    Reviewed-by: Roi Dayan
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin

    Parav Pandit
     
  • [ Upstream commit efe3fa45f770f1d66e2734ee7a3523c75694ff04 ]

    When user had created a FD rule, all the aRFS rules should be clear up.
    HNS3 process flow as below:
    1.get spin lock of fd_ruls_list
    2.clear up all aRFS rules
    3.release lock
    4.get spin lock of fd_ruls_list
    5.creat a rules
    6.release lock;

    There is a short period of time between step 3 and step 4, which would
    creatting some new aRFS FD rules if driver was receiving packet.
    So refactor the fd_rule_lock to fix it.

    Fixes: 441228875706 ("net: hns3: refine the flow director handle")
    Signed-off-by: Guojia Liao
    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Guojia Liao
     
  • [ Upstream commit a7e90ee5965fafc53d36e8b3205f08c88d7bc11f ]

    When the queue depth and queue parameters are modified, there is
    a low probability that TX timeout occurs. The two operations cause
    the link to be down or up when the watchdog is still working. All
    queues are stopped when the link is down. After the carrier is on,
    all queues are woken up. If the watchdog detects the link between
    the carrier on and wakeup queues, a false TX timeout occurs.

    So fix this issue by modifying the sequence of carrier on and queue
    wakeup, which is symmetrical to the link down action.

    Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
    Signed-off-by: Yonglong Liu
    Signed-off-by: Huazhong Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Yonglong Liu
     
  • [ Upstream commit 04a8a3d0a73f51c7c2da84f494db7ec1df230e69 ]

    The slow path for traced system call entries accessed a wrong memory
    location to get the number of the maximum allowed system call number.
    Renumber the numbered "local" label for the correct location to avoid
    collisions with actual local labels.

    Signed-off-by: Michael Karcher
    Tested-by: John Paul Adrian Glaubitz
    Fixes: f3a8308864f920d2 ("sh: Add a few missing irqflags tracing markers.")
    Signed-off-by: Rich Felker
    Signed-off-by: Sasha Levin

    Michael Karcher
     
  • [ Upstream commit c7bcbc8ab9cb20536b8f50c62a48cebda965fdba ]

    Geert reported that his SH7722-based Migo-R board failed to boot after
    commit:

    c5b27a889da9 ("sh/tlb: Convert SH to generic mmu_gather")

    That commit fell victim to copying the wrong pattern --
    __pmd_free_tlb() used to be implemented with pmd_free().

    Fixes: c5b27a889da9 ("sh/tlb: Convert SH to generic mmu_gather")
    Reported-by: Geert Uytterhoeven
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Geert Uytterhoeven
    Tested-by: Geert Uytterhoeven
    Signed-off-by: Rich Felker
    Signed-off-by: Sasha Levin

    Peter Zijlstra
     
  • [ Upstream commit b4da96ffd30bd4a305045ba5c9b0de5d4aa20dc7 ]

    On powerpcle, int64_t maps to long long. Clang 9 threw:
    warning: absolute value function 'labs' given an argument of type \
    'long long' but has parameter of type 'long' which may cause \
    truncation of value [-Wabsolute-value]
    if (labs(tstop - texpect) > cfg_variance_us)

    Tested: make -C tools/testing/selftests TARGETS="net" run_tests

    Fixes: af5136f95045 ("selftests/net: SO_TXTIME with ETF and FQ")
    Signed-off-by: Tanner Love
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Tanner Love
     
  • [ Upstream commit 64f9ede2274980076423583683d44480909b7a40 ]

    Clang 9 threw:
    warning: format specifies type 'unsigned short' but the argument has \
    type 'int' [-Wformat]
    typeflags, PORT_BASE, PORT_BASE + port_off);

    Tested: make -C tools/testing/selftests TARGETS="net" run_tests

    Fixes: 77f65ebdca50 ("packet: packet fanout rollover during socket overload")
    Signed-off-by: Tanner Love
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Tanner Love
     
  • [ Upstream commit 955cbe91bcf782c09afe369c95a20f0a4b6dcc3c ]

    The signedness of char is implementation-dependent. Some systems
    (including PowerPC and ARM) use unsigned char. Clang 9 threw:
    warning: result of comparison of constant -1 with expression of type \
    'char' is always true [-Wtautological-constant-out-of-range-compare]
    &arg_index)) != -1) {

    Tested: make -C tools/testing/selftests TARGETS="net" run_tests

    Fixes: 16e781224198 ("selftests/net: Add a test to validate behavior of rx timestamps")
    Signed-off-by: Tanner Love
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Tanner Love
     
  • [ Upstream commit adc99fd378398f4c58798a1c57889872967d56a6 ]

    If the controller died exactly when we are receiving icresp
    we hang because icresp may never return. Make sure to set a
    high finite limit.

    Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
    Signed-off-by: Sagi Grimberg
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Sasha Levin

    Sagi Grimberg
     
  • [ Upstream commit 09781ba0395c46b1c844f47e405e3ce7856f5989 ]

    To support the change in "phy: armada-38x: fix NETA lockup when
    repeatedly switching speeds" we need to update the DT with the
    additional register.

    Fixes: 14dc100b4411 ("phy: armada38x: add common phy support")
    Signed-off-by: Russell King
    Reviewed-by: Andrew Lunn
    Signed-off-by: Gregory CLEMENT
    Signed-off-by: Sasha Levin

    Russell King
     
  • [ Upstream commit 101dde4207f1daa1fda57d714814a03835dccc3f ]

    The commits "xfrm: Move dst->path into struct xfrm_dst"
    and "net: Create and use new helper xfrm_dst_child()."
    changed xfrm bundle handling under the assumption
    that xdst->path and dst->child are not a NULL pointer
    only if dst->xfrm is not a NULL pointer. That is true
    with one exception. If the xfrm hold queue is used
    to wait until a SA is installed by the key manager,
    we create a dummy bundle without a valid dst->xfrm
    pointer. The current xfrm bundle handling crashes
    in that case. Fix this by extending the NULL check
    of dst->xfrm with a test of the DST_XFRM_QUEUE flag.

    Fixes: 0f6c480f23f4 ("xfrm: Move dst->path into struct xfrm_dst")
    Fixes: b92cf4aab8e6 ("net: Create and use new helper xfrm_dst_child().")
    Signed-off-by: Steffen Klassert
    Signed-off-by: Sasha Levin

    Steffen Klassert
     
  • [ Upstream commit 92025b90f18d45e26b7f17d68756b1abd771b9d3 ]

    The hardware codec on the A10, A10s, A13 and A20 needs buffer in the
    first 256MB of RAM. This was solved by setting the CMA pool at a fixed
    address in that range.

    However, in recent kernels there's something else that comes in and
    reserve some range that end up conflicting with our default pool
    requirement, and thus makes its reservation fail.

    The video codec will then use buffers from the usual default pool,
    outside of the range it can access, and will fail to decode anything.

    Since we're only concerned about that 256MB, we can however relax the
    allocation to just specify the range that's allowed, and not try to
    enforce a specific address.

    Fixes: 5949bc5602cc ("ARM: dts: sun4i-a10: Add Video Engine and reserved memory nodes")
    Fixes: 960432010156 ("ARM: dts: sun5i: Add Video Engine and reserved memory nodes")
    Fixes: c2a641a74850 ("ARM: dts: sun7i-a20: Add Video Engine and reserved memory nodes")
    Signed-off-by: Maxime Ripard
    Acked-by: Chen-Yu Tsai
    Link: https://lore.kernel.org/r/20200704130829.34297-1-maxime@cerno.tech
    Signed-off-by: Sasha Levin

    Maxime Ripard
     
  • [ Upstream commit 4f47e8ab6ab796b5380f74866fa5287aca4dcc58 ]

    In commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"),
    it would take 'priority' to make a policy unique, and allow duplicated
    policies with different 'priority' to be added, which is not expected
    by userland, as Tobias reported in strongswan.

    To fix this duplicated policies issue, and also fix the issue in
    commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"),
    when doing add/del/get/update on user interfaces, this patch is to change
    to look up a policy with both mark and mask by doing:

    mark.v == pol->mark.v && mark.m == pol->mark.m

    and leave the check:

    (mark & pol->mark.m) == pol->mark.v

    for tx/rx path only.

    As the userland expects an exact mark and mask match to manage policies.

    v1->v2:
    - make xfrm_policy_mark_match inline and fix the changelog as
    Tobias suggested.

    Fixes: 295fae568885 ("xfrm: Allow user space manipulation of SPD mark")
    Fixes: ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list")
    Reported-by: Tobias Brunner
    Tested-by: Tobias Brunner
    Signed-off-by: Xin Long
    Signed-off-by: Steffen Klassert
    Signed-off-by: Sasha Levin

    Xin Long
     
  • commit 8999dc89497ab1c80d0718828e838c7cd5f6bffe upstream.

    We should check null before do x25_neigh_put in x25_disconnect,
    otherwise may cause null-ptr-deref like this:

    #include
    #include

    int main() {
    int sck_x25;
    sck_x25 = socket(AF_X25, SOCK_SEQPACKET, 0);
    close(sck_x25);
    return 0;
    }

    BUG: kernel NULL pointer dereference, address: 00000000000000d8
    CPU: 0 PID: 4817 Comm: t2 Not tainted 5.7.0-rc3+ #159
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-
    RIP: 0010:x25_disconnect+0x91/0xe0
    Call Trace:
    x25_release+0x18a/0x1b0
    __sock_release+0x3d/0xc0
    sock_close+0x13/0x20
    __fput+0x107/0x270
    ____fput+0x9/0x10
    task_work_run+0x6d/0xb0
    exit_to_usermode_loop+0x102/0x110
    do_syscall_64+0x23c/0x260
    entry_SYSCALL_64_after_hwframe+0x49/0xb3

    Reported-by: syzbot+6db548b615e5aeefdce2@syzkaller.appspotmail.com
    Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
    Signed-off-by: YueHaibing
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     
  • commit 4becb7ee5b3d2829ed7b9261a245a77d5b7de902 upstream.

    x25_connect() invokes x25_get_neigh(), which returns a reference of the
    specified x25_neigh object to "x25->neighbour" with increased refcnt.

    When x25 connect success and returns, the reference still be hold by
    "x25->neighbour", so the refcount should be decreased in
    x25_disconnect() to keep refcount balanced.

    The reference counting issue happens in x25_disconnect(), which forgets
    to decrease the refcnt increased by x25_get_neigh() in x25_connect(),
    causing a refcnt leak.

    Fix this issue by calling x25_neigh_put() before x25_disconnect()
    returns.

    Signed-off-by: Xiyu Yang
    Signed-off-by: Xin Tan
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xiyu Yang
     
  • commit 39efdd94e314336f4acbac4c07e0f37bdc3bef71 upstream.

    In binutils 2.35, 'nm -D' changed to show symbol versions along with
    symbol names, with the usual @@ separator. When generating
    libtraceevent-dynamic-list we need just the names, so strip off the
    version suffix if present.

    Signed-off-by: Ben Hutchings
    Tested-by: Salvatore Bonaccorso
    Reviewed-by: Steven Rostedt
    Cc: linux-trace-devel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Ben Hutchings
     
  • commit bbc8a99e952226c585ac17477a85ef1194501762 upstream.

    rds_notify_queue_get() is potentially copying uninitialized kernel stack
    memory to userspace since the compiler may leave a 4-byte hole at the end
    of `cmsg`.

    In 2016 we tried to fix this issue by doing `= { 0 };` on `cmsg`, which
    unfortunately does not always initialize that 4-byte hole. Fix it by using
    memset() instead.

    Cc: stable@vger.kernel.org
    Fixes: f037590fff30 ("rds: fix a leak of kernel memory")
    Fixes: bdbe6fbc6a2f ("RDS: recv.c")
    Suggested-by: Dan Carpenter
    Signed-off-by: Peilin Ye
    Acked-by: Santosh Shilimkar
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     
  • commit 8490d6a7e0a0a6fab5c2d82d57a3937306660864 upstream.

    A use-after-free in drm_gem_open_ioctl can happen if the
    GEM object handle is closed between the idr lookup and
    retrieving the size from said object since a local reference
    is not being held at that point. Hold the local reference
    while the object can still be accessed to fix this and
    plug the potential security hole.

    Signed-off-by: Steve Cohen
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/1595284250-31580-1-git-send-email-cohens@codeaurora.org
    Signed-off-by: Greg Kroah-Hartman

    Steve Cohen
     
  • commit 900ab59e2621053b009f707f80b2c19ce0af5dee upstream.

    The function mipi_dbi_spi1_transfer() will transfer its payload as 9-bit
    data, the 9th (MSB) bit being the data/command bit. In order to do that,
    it unpacks the 8-bit values into 16-bit values, then sets the 9th bit if
    the byte corresponds to data, clears it otherwise. The 7 MSB are
    padding. The array of now 16-bit values is then passed to the SPI core
    for transfer.

    This function was broken since its introduction, as the length of the
    SPI transfer was set to the payload size before its conversion, but the
    payload doubled in size due to the 8-bit -> 16-bit conversion.

    Fixes: 02dd95fe3169 ("drm/tinydrm: Add MIPI DBI support")
    Cc: # 5.4+
    Signed-off-by: Paul Cercueil
    Reviewed-by: Sam Ravnborg
    Reviewed-by: Noralf Trønnes
    Signed-off-by: Sam Ravnborg
    Link: https://patchwork.freedesktop.org/patch/msgid/20200703141341.1266263-1-paul@crapouillou.net
    Signed-off-by: Greg Kroah-Hartman

    Paul Cercueil
     
  • commit 543e8669ed9bfb30545fd52bc0e047ca4df7fb31 upstream.

    Compiler leaves a 4-byte hole near the end of `dev_info`, causing
    amdgpu_info_ioctl() to copy uninitialized kernel stack memory to userspace
    when `size` is greater than 356.

    In 2015 we tried to fix this issue by doing `= {};` on `dev_info`, which
    unfortunately does not initialize that 4-byte hole. Fix it by using
    memset() instead.

    Cc: stable@vger.kernel.org
    Fixes: c193fa91b918 ("drm/amdgpu: information leak in amdgpu_info_ioctl()")
    Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
    Suggested-by: Dan Carpenter
    Reviewed-by: Christian König
    Signed-off-by: Peilin Ye
    Signed-off-by: Alex Deucher
    Signed-off-by: Greg Kroah-Hartman

    Peilin Ye
     
  • commit fde9f39ac7f1ffd799a96ffa1e06b2051f0898f1 upstream.

    This patch fixes a race condition that causes a use-after-free during
    amdgpu_dm_atomic_commit_tail. This can occur when 2 non-blocking commits
    are requested and the second one finishes before the first. Essentially,
    this bug occurs when the following sequence of events happens:

    1. Non-blocking commit #1 is requested w/ a new dm_state #1 and is
    deferred to the workqueue.

    2. Non-blocking commit #2 is requested w/ a new dm_state #2 and is
    deferred to the workqueue.

    3. Commit #2 starts before commit #1, dm_state #1 is used in the
    commit_tail and commit #2 completes, freeing dm_state #1.

    4. Commit #1 starts after commit #2 completes, uses the freed dm_state
    1 and dereferences a freelist pointer while setting the context.

    Since this bug has only been spotted with fast commits, this patch fixes
    the bug by clearing the dm_state instead of using the old dc_state for
    fast updates. In addition, since dm_state is only used for its dc_state
    and amdgpu_dm_atomic_commit_tail will retain the dc_state if none is found,
    removing the dm_state should not have any consequences in fast updates.

    This use-after-free bug has existed for a while now, but only caused a
    noticeable issue starting from 5.7-rc1 due to 3202fa62f ("slub: relocate
    freelist pointer to middle of object") moving the freelist pointer from
    dm_state->base (which was unused) to dm_state->context (which is
    dereferenced).

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207383
    Fixes: bd200d190f45 ("drm/amd/display: Don't replace the dc_state for fast updates")
    Reported-by: Duncan
    Signed-off-by: Mazin Rezk
    Reviewed-by: Nicholas Kazlauskas
    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Mazin Rezk
     
  • commit 87004abfbc27261edd15716515d89ab42198b405 upstream.

    This regressed some working configurations so revert it. Will
    fix this properly for 5.9 and backport then.

    This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

    Signed-off-by: Alex Deucher
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Alex Deucher
     
  • commit 168c358af2f8c5a37f8b5f877ba2cc93995606ee upstream.

    free cmd id is read using virtio endian, spec says all fields
    in balloon are LE. Fix it up.

    Fixes: 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang
    Reviewed-by: Wei Wang
    Acked-by: David Hildenbrand
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     
  • commit 4a601da92c2a782e5c022680d476104586b74994 upstream.

    The current pin muxing scheme muxes GPIO_1 pad for USB_OTG_ID
    because of which when card is inserted, usb otg is enumerated
    and the card is never detected.

    [ 64.492645] cfg80211: failed to load regulatory.db
    [ 64.492657] imx-sdma 20ec000.sdma: external firmware not found, using ROM firmware
    [ 76.343711] ci_hdrc ci_hdrc.0: EHCI Host Controller
    [ 76.349742] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 2
    [ 76.388862] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
    [ 76.396650] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.08
    [ 76.405412] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 76.412763] usb usb2: Product: EHCI Host Controller
    [ 76.417666] usb usb2: Manufacturer: Linux 5.8.0-rc1-next-20200618 ehci_hcd
    [ 76.424623] usb usb2: SerialNumber: ci_hdrc.0
    [ 76.431755] hub 2-0:1.0: USB hub found
    [ 76.435862] hub 2-0:1.0: 1 port detected

    The TRM mentions GPIO_1 pad should be muxed/assigned for card detect
    and ENET_RX_ER pad for USB_OTG_ID for proper operation.

    This patch fixes pin muxing as per TRM and is tested on a
    i.Core 1.5 MX6 DL SOM.

    [ 22.449165] mmc0: host does not support reading read-only switch, assuming write-enable
    [ 22.459992] mmc0: new high speed SDHC card at address 0001
    [ 22.469725] mmcblk0: mmc0:0001 EB1QT 29.8 GiB
    [ 22.478856] mmcblk0: p1 p2

    Fixes: 6df11287f7c9 ("ARM: dts: imx6q: Add Engicam i.CoreM6 Quad/Dual initial support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Trimarchi
    Signed-off-by: Suniel Mahesh
    Signed-off-by: Shawn Guo
    Signed-off-by: Greg Kroah-Hartman

    Michael Trimarchi
     
  • commit c696afd331be1acb39206aba53048f2386b781fc upstream.

    Commit 0672d22a1924 ("ARM: dts: imx: Fix the AR803X phy-mode") fixed the
    phy-mode for fec1, but missed to fix it for the fec2 node.

    Fix fec2 to also use "rgmii-id" as the phy-mode.

    Cc:
    Fixes: 0672d22a1924 ("ARM: dts: imx: Fix the AR803X phy-mode")
    Signed-off-by: Fabio Estevam
    Signed-off-by: Shawn Guo
    Signed-off-by: Greg Kroah-Hartman

    Fabio Estevam
     
  • commit d36f260718d83928e6012247a7e1b9791cdb12ff upstream.

    Commit 0672d22a1924 ("ARM: dts: imx: Fix the AR803X phy-mode") fixed the
    phy-mode for fec1, but missed to fix it for the fec2 node.

    Fix fec2 to also use "rgmii-id" as the phy-mode.

    Cc:
    Fixes: 0672d22a1924 ("ARM: dts: imx: Fix the AR803X phy-mode")
    Signed-off-by: Fabio Estevam
    Signed-off-by: Shawn Guo
    Signed-off-by: Greg Kroah-Hartman

    Fabio Estevam
     
  • commit eec13b42d41b0f3339dcf0c4da43734427c68620 upstream.

    Unprivileged memory accesses generated by the so-called "translated"
    instructions (e.g. LDRT) in kernel mode can cause user watchpoints to fire
    unexpectedly. In such cases, the hw_breakpoint logic will invoke the user
    overflow handler which will typically raise a SIGTRAP back to the current
    task. This is futile when returning back to the kernel because (a) the
    signal won't have been delivered and (b) userspace can't handle the thing
    anyway.

    Avoid invoking the user overflow handler for watchpoints triggered by
    kernel uaccess routines, and instead single-step over the faulting
    instruction as we would if no overflow handler had been installed.

    Cc:
    Fixes: f81ef4a920c8 ("ARM: 6356/1: hw-breakpoint: add ARM backend for the hw-breakpoint framework")
    Reported-by: Luis Machado
    Tested-by: Luis Machado
    Signed-off-by: Will Deacon
    Signed-off-by: Russell King
    Signed-off-by: Greg Kroah-Hartman

    Will Deacon
     
  • commit 6989310f5d4327e8595664954edd40a7f99ddd0d upstream.

    Use offsetof to calculate offset of a field to take advantage of
    compiler built-in version when possible, and avoid UBSAN warning when
    compiling with Clang:

    ==================================================================
    UBSAN: Undefined behaviour in net/wireless/wext-core.c:525:14
    member access within null pointer of type 'struct iw_point'
    CPU: 3 PID: 165 Comm: kworker/u16:3 Tainted: G S W 4.19.23 #43
    Workqueue: cfg80211 __cfg80211_scan_done [cfg80211]
    Call trace:
    dump_backtrace+0x0/0x194
    show_stack+0x20/0x2c
    __dump_stack+0x20/0x28
    dump_stack+0x70/0x94
    ubsan_epilogue+0x14/0x44
    ubsan_type_mismatch_common+0xf4/0xfc
    __ubsan_handle_type_mismatch_v1+0x34/0x54
    wireless_send_event+0x3cc/0x470
    ___cfg80211_scan_done+0x13c/0x220 [cfg80211]
    __cfg80211_scan_done+0x28/0x34 [cfg80211]
    process_one_work+0x170/0x35c
    worker_thread+0x254/0x380
    kthread+0x13c/0x158
    ret_from_fork+0x10/0x18
    ===================================================================

    Signed-off-by: Pi-Hsun Shih
    Reviewed-by: Nick Desaulniers
    Link: https://lore.kernel.org/r/20191204081307.138765-1-pihsun@chromium.org
    Signed-off-by: Johannes Berg
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Greg Kroah-Hartman

    Pi-Hsun Shih
     
  • commit 74d6a5d5662975aed7f25952f62efbb6f6dadd29 upstream.

    p9_read_work and p9_fd_cancelled may be called concurrently.
    In some cases, req->req_list may be deleted by both p9_read_work
    and p9_fd_cancelled.

    We can fix it by ignoring replies associated with a cancelled
    request and ignoring cancelled request if message has been received
    before lock.

    Link: http://lkml.kernel.org/r/20200612090833.36149-1-wanghai38@huawei.com
    Fixes: 60ff779c4abb ("9p: client: remove unused code and any reference to "cancelled" function")
    Cc: # v3.12+
    Reported-by: syzbot+77a25acfa0382e06ab23@syzkaller.appspotmail.com
    Signed-off-by: Wang Hai
    Signed-off-by: Dominique Martinet
    Signed-off-by: Greg Kroah-Hartman

    Wang Hai
     
  • commit 295c1b9852d000580786375304a9800bd9634d15 upstream.

    vhost/scsi doesn't handle type conversion correctly
    for request type when using virtio 1.0 and up for BE,
    or cross-endian platforms.

    Fix it up using vhost_32_to_cpu.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin
    Acked-by: Jason Wang
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: Greg Kroah-Hartman

    Michael S. Tsirkin
     
  • commit 54a485e9ec084da1a4b32dcf7749c7d760ed8aa5 upstream.

    The lookaside count is improperly initialized to the size of the
    Receive Queue with the additional +1. In the traces below, the
    RQ size is 384, so the count was set to 385.

    The lookaside count is then rarely refreshed. Note the high and
    incorrect count in the trace below:

    rvt_get_rwqe: [hfi1_0] wqe ffffc900078e9008 wr_id 55c7206d75a0 qpn c
    qpt 2 pid 3018 num_sge 1 head 1 tail 0, count 385
    rvt_get_rwqe: (hfi1_rc_rcv+0x4eb/0x1480 [hfi1]
    Cc: # 5.4.x
    Reviewed-by: Kaike Wan
    Signed-off-by: Mike Marciniszyn
    Tested-by: Honggang Li
    Signed-off-by: Jason Gunthorpe
    Signed-off-by: Greg Kroah-Hartman

    Mike Marciniszyn
     
  • commit c2c3657f0aedb8736a0fb7b2b1985adfb86e7802 upstream.

    It's been reported that, when neither nouveau nor Nvidia graphics
    driver is used, the screen starts flickering. And, after comparing
    between the working case (stable 4.4.x) and the broken case, it turned
    out that the problem comes from the audio component binding. The
    Nvidia and AMD audio binding code clears the bus->keep_power flag
    whenever snd_hdac_acomp_init() succeeds. But this doesn't mean that
    the component is actually bound, but it merely indicates that it's
    ready for binding. So, when both nouveau and Nvidia are blacklisted
    or not ready, the driver keeps running without the audio component but
    also with bus->keep_power = false. This made the driver runtime PM
    kicked in and powering down when unused, which results in flickering
    in the graphics side, as it seems.

    For fixing the bug, this patch moves the bus->keep_power flag change
    into generic_acomp_notifier_set() that is the function called from the
    master_bind callback of component ops; i.e. it's guaranteed that the
    binding succeeded.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208609
    Fixes: 5a858e79c911 ("ALSA: hda - Disable audio component for legacy Nvidia HDMI codecs")
    Cc:
    Link: https://lore.kernel.org/r/20200728082033.23933-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 5649625344fe1f4695eace7c37d011e317bf66d5 upstream.

    HP NB right speaker had no sound output.
    This platform was connected to I2S Amp for speaker out.(None Realtek I2S Amp IC)
    EC need to check codec GPIO1 pin to initial I2S Amp.

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

    Kailang Yang