05 Aug, 2020

13 commits

  • [ Upstream commit 3c8ce24b037648a5a15b85888b259a74b05ff97d ]

    The lifetime of EMAD transactions (i.e., 'struct mlxsw_reg_trans') is
    managed using RCU. They are freed using kfree_rcu() once the transaction
    ends.

    However, in case the transaction failed it is freed immediately after being
    removed from the active transactions list. This is problematic because it is
    still possible for a different CPU to dereference the transaction from an RCU
    read-side critical section while traversing the active transaction list in
    mlxsw_emad_rx_listener_func(). In which case, a use-after-free is triggered
    [1].

    Fix this by freeing the transaction after a grace period by calling
    kfree_rcu().

    [1]
    BUG: KASAN: use-after-free in mlxsw_emad_rx_listener_func+0x969/0xac0 drivers/net/ethernet/mellanox/mlxsw/core.c:671
    Read of size 8 at addr ffff88800b7964e8 by task syz-executor.2/2881

    CPU: 0 PID: 2881 Comm: syz-executor.2 Not tainted 5.8.0-rc4+ #44
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
    Call Trace:

    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0xf6/0x16e lib/dump_stack.c:118
    print_address_description.constprop.0+0x1c/0x250 mm/kasan/report.c:383
    __kasan_report mm/kasan/report.c:513 [inline]
    kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
    mlxsw_emad_rx_listener_func+0x969/0xac0 drivers/net/ethernet/mellanox/mlxsw/core.c:671
    mlxsw_core_skb_receive+0x571/0x700 drivers/net/ethernet/mellanox/mlxsw/core.c:2061
    mlxsw_pci_cqe_rdq_handle drivers/net/ethernet/mellanox/mlxsw/pci.c:595 [inline]
    mlxsw_pci_cq_tasklet+0x12a6/0x2520 drivers/net/ethernet/mellanox/mlxsw/pci.c:651
    tasklet_action_common.isra.0+0x13f/0x3e0 kernel/softirq.c:550
    __do_softirq+0x223/0x964 kernel/softirq.c:292
    asm_call_on_stack+0x12/0x20 arch/x86/entry/entry_64.S:711

    __run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline]
    run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline]
    do_softirq_own_stack+0x109/0x140 arch/x86/kernel/irq_64.c:77
    invoke_softirq kernel/softirq.c:387 [inline]
    __irq_exit_rcu kernel/softirq.c:417 [inline]
    irq_exit_rcu+0x16f/0x1a0 kernel/softirq.c:429
    sysvec_apic_timer_interrupt+0x4e/0xd0 arch/x86/kernel/apic/apic.c:1091
    asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:587
    RIP: 0010:arch_local_irq_restore arch/x86/include/asm/irqflags.h:85 [inline]
    RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
    RIP: 0010:_raw_spin_unlock_irqrestore+0x3b/0x40 kernel/locking/spinlock.c:191
    Code: e8 2a c3 f4 fc 48 89 ef e8 12 96 f5 fc f6 c7 02 75 11 53 9d e8 d6 db 11 fd 65 ff 0d 1f 21 b3 56 5b 5d c3 e8 a7 d7 11 fd 53 9d ed 0f 1f 00 55 48 89 fd 65 ff 05 05 21 b3 56 ff 74 24 08 48 8d
    RSP: 0018:ffff8880446ffd80 EFLAGS: 00000286
    RAX: 0000000000000006 RBX: 0000000000000286 RCX: 0000000000000006
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffffa94ecea9
    RBP: ffff888012934408 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000001 R11: fffffbfff57be301 R12: 1ffff110088dffc1
    R13: ffff888037b817c0 R14: ffff88802442415a R15: ffff888024424000
    __do_sys_perf_event_open+0x1b5d/0x2bd0 kernel/events/core.c:11874
    do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:384
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x473dbd
    Code: Bad RIP value.
    RSP: 002b:00007f21e5e9cc28 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
    RAX: ffffffffffffffda RBX: 000000000057bf00 RCX: 0000000000473dbd
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000040
    RBP: 000000000057bf00 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000003 R11: 0000000000000246 R12: 000000000057bf0c
    R13: 00007ffd0493503f R14: 00000000004d0f46 R15: 00007f21e5e9cd80

    Allocated by task 871:
    save_stack+0x1b/0x40 mm/kasan/common.c:48
    set_track mm/kasan/common.c:56 [inline]
    __kasan_kmalloc mm/kasan/common.c:494 [inline]
    __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:467
    kmalloc include/linux/slab.h:555 [inline]
    kzalloc include/linux/slab.h:669 [inline]
    mlxsw_core_reg_access_emad+0x70/0x1410 drivers/net/ethernet/mellanox/mlxsw/core.c:1812
    mlxsw_core_reg_access+0xeb/0x540 drivers/net/ethernet/mellanox/mlxsw/core.c:1991
    mlxsw_sp_port_get_hw_xstats+0x335/0x7e0 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1130
    update_stats_cache+0xf4/0x140 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1173
    process_one_work+0xa3e/0x17a0 kernel/workqueue.c:2269
    worker_thread+0x9e/0x1050 kernel/workqueue.c:2415
    kthread+0x355/0x470 kernel/kthread.c:291
    ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:293

    Freed by task 871:
    save_stack+0x1b/0x40 mm/kasan/common.c:48
    set_track mm/kasan/common.c:56 [inline]
    kasan_set_free_info mm/kasan/common.c:316 [inline]
    __kasan_slab_free+0x12c/0x170 mm/kasan/common.c:455
    slab_free_hook mm/slub.c:1474 [inline]
    slab_free_freelist_hook mm/slub.c:1507 [inline]
    slab_free mm/slub.c:3072 [inline]
    kfree+0xe6/0x320 mm/slub.c:4052
    mlxsw_core_reg_access_emad+0xd45/0x1410 drivers/net/ethernet/mellanox/mlxsw/core.c:1819
    mlxsw_core_reg_access+0xeb/0x540 drivers/net/ethernet/mellanox/mlxsw/core.c:1991
    mlxsw_sp_port_get_hw_xstats+0x335/0x7e0 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1130
    update_stats_cache+0xf4/0x140 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1173
    process_one_work+0xa3e/0x17a0 kernel/workqueue.c:2269
    worker_thread+0x9e/0x1050 kernel/workqueue.c:2415
    kthread+0x355/0x470 kernel/kthread.c:291
    ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:293

    The buggy address belongs to the object at ffff88800b796400
    which belongs to the cache kmalloc-512 of size 512
    The buggy address is located 232 bytes inside of
    512-byte region [ffff88800b796400, ffff88800b796600)
    The buggy address belongs to the page:
    page:ffffea00002de500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea00002de500 order:2 compound_mapcount:0 compound_pincount:0
    flags: 0x100000000010200(slab|head)
    raw: 0100000000010200 dead000000000100 dead000000000122 ffff88806c402500
    raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff88800b796380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    ffff88800b796400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff88800b796480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff88800b796500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff88800b796580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

    Fixes: caf7297e7ab5 ("mlxsw: core: Introduce support for asynchronous EMAD register access")
    Signed-off-by: Ido Schimmel
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Ido Schimmel
     
  • [ Upstream commit 7d8e8f3433dc8d1dc87c1aabe73a154978fb4c4d ]

    The lifetime of the Rx listener item ('rxl_item') is managed using RCU,
    but is dereferenced outside of RCU read-side critical section, which can
    lead to a use-after-free.

    Fix this by increasing the scope of the RCU read-side critical section.

    Fixes: 93c1edb27f9e ("mlxsw: Introduce Mellanox switch driver core")
    Signed-off-by: Ido Schimmel
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Ido Schimmel
     
  • [ Upstream commit 3cab8c65525920f00d8f4997b3e9bb73aecb3a8e ]

    It appears that not disabling a PCI device on .shutdown may lead to
    a Hardware Error with particular (perhaps buggy) BIOS versions:

    mlx4_en: eth0: Close port called
    mlx4_en 0000:04:00.0: removed PHC
    reboot: Restarting system
    {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
    {1}[Hardware Error]: event severity: fatal
    {1}[Hardware Error]: Error 0, type: fatal
    {1}[Hardware Error]: section_type: PCIe error
    {1}[Hardware Error]: port_type: 4, root port
    {1}[Hardware Error]: version: 1.16
    {1}[Hardware Error]: command: 0x4010, status: 0x0143
    {1}[Hardware Error]: device_id: 0000:00:02.2
    {1}[Hardware Error]: slot: 0
    {1}[Hardware Error]: secondary_bus: 0x04
    {1}[Hardware Error]: vendor_id: 0x8086, device_id: 0x2f06
    {1}[Hardware Error]: class_code: 000604
    {1}[Hardware Error]: bridge: secondary_status: 0x2000, control: 0x0003
    {1}[Hardware Error]: aer_uncor_status: 0x00100000, aer_uncor_mask: 0x00000000
    {1}[Hardware Error]: aer_uncor_severity: 0x00062030
    {1}[Hardware Error]: TLP Header: 40000018 040000ff 791f4080 00000000
    [hw error repeats]
    Kernel panic - not syncing: Fatal hardware error!
    CPU: 0 PID: 2189 Comm: reboot Kdump: loaded Not tainted 5.6.x-blabla #1
    Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 05/05/2017

    Fix the mlx4 driver.

    This is a very similar problem to what had been fixed in:
    commit 0d98ba8d70b0 ("scsi: hpsa: disable device during shutdown")
    to address https://bugzilla.kernel.org/show_bug.cgi?id=199779.

    Fixes: 2ba5fbd62b25 ("net/mlx4_core: Handle AER flow properly")
    Reported-by: Jake Lawrence
    Signed-off-by: Jakub Kicinski
    Reviewed-by: Saeed Mahameed
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Jakub Kicinski
     
  • [ 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
     
  • commit cc78dc3b790619aa05f22a86a9152986bd73698c upstream.

    For all data packets transmitted, host gets htt tx completion event. Some QCA9984
    firmware releases support WMI_SERVICE_TX_DATA_ACK_RSSI, which gives data
    ack rssi values to host through htt event of data tx completion. Data ack rssi
    values are valid if A0 bit is set in HTT rx message. So enable the feature also
    for QCA9884.

    Tested HW: QCA9984
    Tested FW: 10.4-3.9.0.2-00044

    Signed-off-by: Abhishek Ambure
    Signed-off-by: Balaji Pothunoori
    [kvalo@codeaurora.org: improve commit log]
    Signed-off-by: Kalle Valo
    Signed-off-by: Sathishkumar Muruganandam
    Signed-off-by: Greg Kroah-Hartman

    Abhishek Ambure
     

01 Aug, 2020

2 commits

  • This reverts commit 40a904b1c2e57b22dd002dfce73688871cb0bac8.

    The patch is not wrong, but the Fixes: tag is. It should have been:

    Fixes: 060ad66f9795 ("dpaa_eth: change DMA device")

    which means that it's fixing a commit which was introduced in:

    git tag --contains 060ad66f97954
    v5.5

    which then means it should have not been backported to linux-5.4.y,
    where things _were_ working and now they're not.

    Reported-by: Joakim Tjernlund
    Signed-off-by: Vladimir Oltean
    Signed-off-by: Greg Kroah-Hartman

    Vladimir Oltean
     
  • [ Upstream commit 8fdcabeac39824fe67480fd9508d80161c541854 ]

    This driver is not working because of problems of its receiving code.
    This patch fixes it to make it work.

    When the driver receives an LAPB frame, it should first pass the frame
    to the LAPB module to process. After processing, the LAPB module passes
    the data (the packet) back to the driver, the driver should then add a
    one-byte pseudo header and pass the data to upper layers.

    The changes to the "x25_asy_bump" function and the
    "x25_asy_data_indication" function are to correctly implement this
    procedure.

    Also, the "x25_asy_unesc" function ignores any frame that is shorter
    than 3 bytes. However the shortest frames are 2-byte long. So we need
    to change it to allow 2-byte frames to pass.

    Cc: Eric Dumazet
    Cc: Martin Schiller
    Signed-off-by: Xie He
    Reviewed-by: Martin Schiller
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Xie He
     

29 Jul, 2020

25 commits

  • commit 92f53e2fda8bb9a559ad61d57bfb397ce67ed0ab upstream.

    This fix allows ath9k_htc modules to connect to WLAN once again.

    Fixes: 2bbcaaee1fcb ("ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=208251
    Signed-off-by: Mark O'Donovan
    Reported-by: Roman Mamedov
    Tested-by: Viktor Jägersküpper
    Signed-off-by: Kalle Valo
    Link: https://lore.kernel.org/r/20200711043324.8079-1-shiftee@posteo.net
    Signed-off-by: Greg Kroah-Hartman

    Mark O'Donovan
     
  • commit 2bbcaaee1fcbd83272e29f31e2bb7e70d8c49e05 upstream.

    In ath9k_hif_usb_rx_cb interface number is assumed to be 0.
    usb_ifnum_to_if(urb->dev, 0)
    But it isn't always true.

    The case reported by syzbot:
    https://lore.kernel.org/linux-usb/000000000000666c9c05a1c05d12@google.com
    usb 2-1: new high-speed USB device number 2 using dummy_hcd
    usb 2-1: config 1 has an invalid interface number: 2 but max is 0
    usb 2-1: config 1 has no interface number 0
    usb 2-1: New USB device found, idVendor=0cf3, idProduct=9271, bcdDevice=
    1.08
    usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    general protection fault, probably for non-canonical address
    0xdffffc0000000015: 0000 [#1] SMP KASAN
    KASAN: null-ptr-deref in range [0x00000000000000a8-0x00000000000000af]
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0-rc5-syzkaller #0

    Call Trace
    __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650
    usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716
    dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
    call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404
    expire_timers kernel/time/timer.c:1449 [inline]
    __run_timers kernel/time/timer.c:1773 [inline]
    __run_timers kernel/time/timer.c:1740 [inline]
    run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786
    __do_softirq+0x21e/0x950 kernel/softirq.c:292
    invoke_softirq kernel/softirq.c:373 [inline]
    irq_exit+0x178/0x1a0 kernel/softirq.c:413
    exiting_irq arch/x86/include/asm/apic.h:546 [inline]
    smp_apic_timer_interrupt+0x141/0x540 arch/x86/kernel/apic/apic.c:1146
    apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829

    Reported-and-tested-by: syzbot+40d5d2e8a4680952f042@syzkaller.appspotmail.com
    Signed-off-by: Qiujun Huang
    Signed-off-by: Kalle Valo
    Link: https://lore.kernel.org/r/20200404041838.10426-6-hqjagain@gmail.com
    Cc: Viktor Jägersküpper
    Signed-off-by: Greg Kroah-Hartman

    Qiujun Huang
     
  • commit fbb1461ad1d6eacca9beb69a2f3ce1b5398d399b upstream.

    iwl_mvm_free_inactive_queue() will sleep in synchronize_net() under
    some circumstances, so don't call it under RCU. There doesn't appear
    to be a need for RCU protection around this particular call.

    Cc: stable@vger.kernel.org # v5.4+
    Signed-off-by: Johannes Berg
    Signed-off-by: Luca Coelho
    Signed-off-by: Kalle Valo
    Link: https://lore.kernel.org/r/iwlwifi.20200403112332.0f49448c133d.I17fd308bc4a9491859c9b112f4eb5d2c3fc18d7d@changeid
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • [ Upstream commit 32818c075c54bb0cae44dd6f7ab00b01c52b8372 ]

    geneve_nl2info() sets 'df' conditionally, so we have to
    initialize it by copying the value from existing geneve
    device in geneve_changelink().

    Fixes: 56c09de347e4 ("geneve: allow changing DF behavior after creation")
    Reported-by: syzbot+7ebc2e088af5e4c0c9fa@syzkaller.appspotmail.com
    Cc: Sabrina Dubroca
    Signed-off-by: Cong Wang
    Reviewed-by: Sabrina Dubroca
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Cong Wang
     
  • [ Upstream commit c75d1d5248c0c97996051809ad0e9f154ba5d76e ]

    Very similar to commit 544f287b8495
    ("bonding: check error value of register_netdevice() immediately"),
    we should immediately check the return value of register_netdevice()
    before doing anything else.

    Fixes: 005db31d5f5f ("bonding: set carrier off for devices created through netlink")
    Reported-and-tested-by: syzbot+bbc3a11c4da63c1b74d6@syzkaller.appspotmail.com
    Cc: Beniamino Galvani
    Cc: Taehee Yoo
    Cc: Jay Vosburgh
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Cong Wang
     
  • [ Upstream commit 26cb7085c8984e5b71d65c374a135134ed8cabb3 ]

    For ENETC ports that register an external MDIO bus,
    the bus doesn't get removed on the error bailout path
    of enetc_pf_probe().

    This issue became much more visible after recent:
    commit 07095c025ac2 ("net: enetc: Use DT protocol information to set up the ports")
    Before this commit, one could make probing fail on the error
    path only by having register_netdev() fail, which is unlikely.
    But after this commit, because it moved the enetc_of_phy_get()
    call up in the probing sequence, now we can trigger an mdiobus_free()
    bug just by forcing enetc_alloc_msix() to return error, i.e. with the
    'pci=nomsi' kernel bootarg (since ENETC relies on MSI support to work),
    as the calltrace below shows:

    kernel BUG at /home/eiz/work/enetc/net/drivers/net/phy/mdio_bus.c:648!
    Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
    [...]
    Hardware name: LS1028A RDB Board (DT)
    pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--)
    pc : mdiobus_free+0x50/0x58
    lr : devm_mdiobus_free+0x14/0x20
    [...]
    Call trace:
    mdiobus_free+0x50/0x58
    devm_mdiobus_free+0x14/0x20
    release_nodes+0x138/0x228
    devres_release_all+0x38/0x60
    really_probe+0x1c8/0x368
    driver_probe_device+0x5c/0xc0
    device_driver_attach+0x74/0x80
    __driver_attach+0x8c/0xd8
    bus_for_each_dev+0x7c/0xd8
    driver_attach+0x24/0x30
    bus_add_driver+0x154/0x200
    driver_register+0x64/0x120
    __pci_register_driver+0x44/0x50
    enetc_pf_driver_init+0x24/0x30
    do_one_initcall+0x60/0x1c0
    kernel_init_freeable+0x1fc/0x274
    kernel_init+0x14/0x110
    ret_from_fork+0x10/0x34

    Fixes: ebfcb23d62ab ("enetc: Add ENETC PF level external MDIO support")
    Signed-off-by: Claudiu Manoil
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Claudiu Manoil
     
  • [ Upstream commit 1264d7fa3a64d8bea7aebb77253f917947ffda25 ]

    When regmap_update_bits failed in ave_init(), calls of the functions
    reset_control_assert() and clk_disable_unprepare() were missed.
    Add goto out_reset_assert to do this.

    Fixes: 57878f2f4697 ("net: ethernet: ave: add support for phy-mode setting of system controller")
    Reported-by: Hulk Robot
    Signed-off-by: Wang Hai
    Reviewed-by: Kunihiko Hayashi
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Wang Hai
     
  • [ Upstream commit eb61c2d69903e977ffa2b80b1da9d1f758cf228d ]

    It was found that qed_pglueb_rbc_attn_handler() can produce a lot of
    false-positive error detections on driver load/reload (especially after
    crashes/recoveries) and spam the kernel log:

    [ 4.958275] [qed_pglueb_rbc_attn_handler:324()]ICPL error - 00d00ff0
    [ 2079.146764] [qed_pglueb_rbc_attn_handler:324()]ICPL error - 00d80ff0
    [ 2116.374631] [qed_pglueb_rbc_attn_handler:324()]ICPL error - 00d80ff0
    [ 2135.250564] [qed_pglueb_rbc_attn_handler:324()]ICPL error - 00d80ff0
    [...]

    Reduce the logging level of two false-positive prone error messages from
    notice to verbose on initialization (only) to not mix it with real error
    attentions while debugging.

    Fixes: 666db4862f2d ("qed: Revise load sequence to avoid PCI errors")
    Signed-off-by: Alexander Lobakin
    Signed-off-by: Igor Russkikh
    Signed-off-by: Michal Kalderon
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Alexander Lobakin
     
  • [ Upstream commit 1ea999039fe7c7953da2fbb7ca7c3ef00064d328 ]

    Change the verbosity of the "don't support RoCE & iWARP simultaneously"
    warning to debug level to stop flooding on driver/hardware initialization:

    [ 4.783230] qede 01:00.00: Storm FW 8.37.7.0, Management FW 8.52.9.0
    [MBI 15.10.6] [eth0]
    [ 4.810020] [qed_rdma_set_pf_params:2076()]Current day drivers don't
    support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only
    [ 4.861186] qede 01:00.01: Storm FW 8.37.7.0, Management FW 8.52.9.0
    [MBI 15.10.6] [eth1]
    [ 4.893311] [qed_rdma_set_pf_params:2076()]Current day drivers don't
    support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only
    [ 5.181713] qede a1:00.00: Storm FW 8.37.7.0, Management FW 8.52.9.0
    [MBI 15.10.6] [eth2]
    [ 5.224740] [qed_rdma_set_pf_params:2076()]Current day drivers don't
    support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only
    [ 5.276449] qede a1:00.01: Storm FW 8.37.7.0, Management FW 8.52.9.0
    [MBI 15.10.6] [eth3]
    [ 5.318671] [qed_rdma_set_pf_params:2076()]Current day drivers don't
    support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only
    [ 5.369548] qede a1:00.02: Storm FW 8.37.7.0, Management FW 8.52.9.0
    [MBI 15.10.6] [eth4]
    [ 5.411645] [qed_rdma_set_pf_params:2076()]Current day drivers don't
    support RoCE & iWARP simultaneously on the same PF. Default to RoCE-only

    Fixes: e0a8f9de16fc ("qed: Add iWARP enablement support")
    Signed-off-by: Alexander Lobakin
    Signed-off-by: Igor Russkikh
    Signed-off-by: Michal Kalderon
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Alexander Lobakin
     
  • [ Upstream commit 2c9d8e01f0c6017317eee7638496173d4a64e6bc ]

    In the nsim_create(), rtnl_lock() is called before nsim_bpf_init().
    If nsim_bpf_init() is failed, rtnl_unlock() should be called,
    but it isn't called.
    So, unbalanced locking would occur.

    Fixes: e05b2d141fef ("netdevsim: move netdev creation/destruction to dev probe")
    Signed-off-by: Taehee Yoo
    Reviewed-by: Jakub Kicinski
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Taehee Yoo
     
  • [ Upstream commit 3506b2f42dff66ea6814c3dfa1988bafb79e6f88 ]

    When doing "ip link set dev ... up" for a ksz9477 backed link,
    ksz9477_phy_setup is called and it calls phy_remove_link_mode to remove
    1000baseT HDX. During phy_remove_link_mode, phy_advertise_supported is
    called. Doing so reverts any previous change to advertised link modes
    e.g. using a udevd .link file.

    phy_remove_link_mode is not meant to be used while opening a link and
    should be called during phy probe when the link is not yet available to
    userspace.

    Therefore move the phy_remove_link_mode calls into
    ksz9477_switch_register. It indirectly calls dsa_register_switch, which
    creates the relevant struct phy_devices and we update the link modes
    right after that. At that time dev->features is already initialized by
    ksz9477_switch_detect.

    Remove phy_setup from ksz_dev_ops as no users remain.

    Link: https://lore.kernel.org/netdev/20200715192722.GD1256692@lunn.ch/
    Fixes: 42fc6a4c613019 ("net: dsa: microchip: prepare PHY for proper advertisement")
    Signed-off-by: Helmut Grohne
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Helmut Grohne
     
  • [ Upstream commit 8ceca59fb3ed48a693171bd571c4fcbd555b7f1f ]

    The content of the TX desc is automatically cleared by the HW
    when the HW has sent out the packet to the wire. When desc filling
    fails in hns3_nic_net_xmit(), it will call hns3_clear_desc() to do
    the error handling, which miss zeroing of the TX desc and the
    checking if a unmapping is needed.

    So add the zeroing and checking in hns3_clear_desc() to avoid the
    above problem. Also add DESC_TYPE_UNKNOWN to indicate the info in
    desc_cb is not valid, because hns3_nic_reclaim_desc() may treat
    the desc_cb->type of zero as packet and add to the sent pkt
    statistics accordingly.

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

    Yunsheng Lin
     
  • [ Upstream commit befc113c56a76ae7be3986034a0e476d3385e265 ]

    The ag71xx_mdio_probe() forgets to call clk_disable_unprepare() when
    of_reset_control_get_exclusive() failed. Add the missed call to fix it.

    Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
    Reported-by: Hulk Robot
    Signed-off-by: Huang Guobin
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Huang Guobin
     
  • [ Upstream commit cbec2153a9a68d011454960ba84887e46e40b37d ]

    Add in a couple of forgotten spinlocks and fix up some of
    the debug messages around filter management.

    Fixes: c1e329ebec8d ("ionic: Add management of rx filters")
    Signed-off-by: Shannon Nelson
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Shannon Nelson
     
  • [ Upstream commit f85ae16f924f92a370b81b4e77862c1c59882fce ]

    Use an offset to write the second half of the regs data into the
    second half of the buffer instead of overwriting the first half.

    Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support")
    Signed-off-by: Shannon Nelson
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Shannon Nelson
     
  • [ Upstream commit 5dbaeb87f2b309936be0aeae00cbc9e7f20ab296 ]

    When mlxsw_core_trap_register fails in mlxsw_emad_init,
    destroy_workqueue() shouled be called to destroy mlxsw_core->emad_wq.

    Fixes: d965465b60ba ("mlxsw: core: Fix possible deadlock")
    Signed-off-by: Liu Jian
    Reviewed-by: Ido Schimmel
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Liu Jian
     
  • [ Upstream commit 544f287b84959203367cd29e16e772717612fab4 ]

    If register_netdevice() is failed, net_device should not be used
    because variables are uninitialized or freed.
    So, the routine should be stopped immediately.
    But, bond_create() doesn't check return value of register_netdevice()
    immediately. That will result in a panic because of using uninitialized
    or freed memory.

    Test commands:
    modprobe netdev-notifier-error-inject
    echo -22 > /sys/kernel/debug/notifier-error-inject/netdev/\
    actions/NETDEV_REGISTER/error
    modprobe bonding max_bonds=3

    Splat looks like:
    [ 375.028492][ T193] general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6b6b: 0000 [#1] SMP DEBUG_PAGEALLOC PTI
    [ 375.033207][ T193] CPU: 2 PID: 193 Comm: kworker/2:2 Not tainted 5.8.0-rc4+ #645
    [ 375.036068][ T193] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
    [ 375.039673][ T193] Workqueue: events linkwatch_event
    [ 375.041557][ T193] RIP: 0010:dev_activate+0x4a/0x340
    [ 375.043381][ T193] Code: 40 a8 04 0f 85 db 00 00 00 8b 83 08 04 00 00 85 c0 0f 84 0d 01 00 00 31 d2 89 d0 48 8d 04 40 48 c1 e0 07 48 03 83 00 04 00 00 8b 48 10 f6 41 10 01 75 08 f0 80 a1 a0 01 00 00 fd 48 89 48 08
    [ 375.050267][ T193] RSP: 0018:ffff9f8facfcfdd8 EFLAGS: 00010202
    [ 375.052410][ T193] RAX: 6b6b6b6b6b6b6b6b RBX: ffff9f8fae6ea000 RCX: 0000000000000006
    [ 375.055178][ T193] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff9f8fae6ea000
    [ 375.057762][ T193] RBP: ffff9f8fae6ea000 R08: 0000000000000000 R09: 0000000000000000
    [ 375.059810][ T193] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9f8facfcfe08
    [ 375.061892][ T193] R13: ffffffff883587e0 R14: 0000000000000000 R15: ffff9f8fae6ea580
    [ 375.063931][ T193] FS: 0000000000000000(0000) GS:ffff9f8fbae00000(0000) knlGS:0000000000000000
    [ 375.066239][ T193] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 375.067841][ T193] CR2: 00007f2f542167a0 CR3: 000000012cee6002 CR4: 00000000003606e0
    [ 375.069657][ T193] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 375.071471][ T193] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [ 375.073269][ T193] Call Trace:
    [ 375.074005][ T193] linkwatch_do_dev+0x4d/0x50
    [ 375.075052][ T193] __linkwatch_run_queue+0x10b/0x200
    [ 375.076244][ T193] linkwatch_event+0x21/0x30
    [ 375.077274][ T193] process_one_work+0x252/0x600
    [ 375.078379][ T193] ? process_one_work+0x600/0x600
    [ 375.079518][ T193] worker_thread+0x3c/0x380
    [ 375.080534][ T193] ? process_one_work+0x600/0x600
    [ 375.081668][ T193] kthread+0x139/0x150
    [ 375.082567][ T193] ? kthread_park+0x90/0x90
    [ 375.083567][ T193] ret_from_fork+0x22/0x30

    Fixes: e826eafa65c6 ("bonding: Call netif_carrier_off after register_netdevice")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Taehee Yoo
     
  • [ Upstream commit bca9749b1aa23d964d3ab930938af66dbf887f15 ]

    If try_toggle_control_gpio() failed in smc_drv_probe(), free_netdev(ndev)
    should be called to free the ndev created earlier. Otherwise, a memleak
    will occur.

    Fixes: 7d2911c43815 ("net: smc91x: Fix gpios for device tree based booting")
    Reported-by: Hulk Robot
    Signed-off-by: Wang Hai
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Wang Hai
     
  • [ Upstream commit 66673f96f0f968b991dc38be06102246919c663c ]

    When probe fail, we should destroy the workqueue.

    Fixes: 2795e8c25161 ("net: ieee802154: fix a potential NULL pointer dereference")
    Signed-off-by: Liu Jian
    Acked-by: Michael Hennerich
    Link: https://lore.kernel.org/r/20200717090121.2143-1-liujian56@huawei.com
    Signed-off-by: Stefan Schmidt
    Signed-off-by: Sasha Levin

    Liu Jian
     
  • [ Upstream commit 473309fb8372365ad211f425bca760af800e10a7 ]

    From Documentation/networking/timestamping.txt:

    A driver which supports hardware time stamping shall update the
    struct with the actual, possibly more permissive configuration.

    Do update the struct passed when we upscale the requested time
    stamping mode.

    Fixes: cb646e2b02b2 ("ptp: Added a clock driver for the National Semiconductor PHYTER.")
    Signed-off-by: Sergey Organov
    Acked-by: Richard Cochran
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Sasha Levin

    Sergey Organov
     
  • [ Upstream commit c28d9a285668c799eeae2f7f93e929a6028a4d6d ]

    If ax88172a_unbind() fails, make sure that the return code is
    less than zero so that cleanup is done properly and avoid UAF.

    Fixes: a9a51bd727d1 ("ax88172a: fix information leak on short answers")
    Signed-off-by: George Kennedy
    Reported-by: syzbot+4cd84f527bf4a10fc9c1@syzkaller.appspotmail.com
    Signed-off-by: Jakub Kicinski
    Signed-off-by: Sasha Levin

    George Kennedy
     
  • [ Upstream commit 3195c4706b00106aa82c73acd28340fa8fc2bfc1 ]

    The size used when calling 'pci_alloc_consistent()' and
    'pci_free_consistent()' should match.

    Fix it and have it consistent with the corresponding call in 'rr_close()'.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Christophe JAILLET
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Christophe JAILLET
     
  • [ Upstream commit 27640ce68d21e556b66bc5fa022aacd26e53c947 ]

    The current completion ring sizing formula is wrong with TPA enabled.
    The formula assumes that the number of TPA completions are bound by the
    RX ring size, but that's not true. TPA_START completions are immediately
    recycled so they are not bound by the RX ring size. We must add
    bp->max_tpa to the worst case maximum RX and TPA completions.

    The completion ring can overflow because of this mistake. This will
    cause hardware to disable the completion ring when this happens,
    leading to RX and TX traffic to stall on that ring. This issue is
    generally exposed only when the RX ring size is set very small.

    Fix the formula by adding bp->max_tpa to the number of RX completions
    if TPA is enabled.

    Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.");
    Reviewed-by: Vasundhara Volam
    Signed-off-by: Michael Chan
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Michael Chan
     
  • [ Upstream commit 163e9ef63641a02de4c95cd921577265c52e1ce2 ]

    The driver was modified to not rely on rtnl lock to protect link
    settings about 2 years ago. The pause setting was missed when
    making that change. Fix it by acquiring link_lock mutex before
    calling bnxt_hwrm_set_pause().

    Fixes: e2dc9b6e38fa ("bnxt_en: Don't use rtnl lock to protect link change logic in workqueue.")
    Signed-off-by: Vasundhara Volam
    Reviewed-by: Edwin Peer
    Signed-off-by: Michael Chan
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Vasundhara Volam
     
  • [ Upstream commit 28b18e4eb515af7c6661c3995c6e3c34412c2874 ]

    clang static analysis flags this garbage return

    drivers/net/ethernet/marvell/sky2.c:208:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
    return v;
    ^~~~~~~~

    static inline u16 gm_phy_read( ...
    {
    u16 v;
    __gm_phy_read(hw, port, reg, &v);
    return v;
    }

    __gm_phy_read can return without setting v.

    So handle similar to skge.c's gm_phy_read, initialize v.

    Signed-off-by: Tom Rix
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Tom Rix