05 Aug, 2020

17 commits

  • [ Upstream commit e6827d1abdc9b061a57d7b7d3019c4e99fabea2f ]

    In the implementation of uld_send(), the skb is consumed on all
    execution paths except one. Release skb when returning NET_XMIT_DROP.

    Signed-off-by: Navid Emamdoost
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Navid Emamdoost
     
  • [ Upstream commit 015c5d5e6aa3523c758a70eb87b291cece2dbbb4 ]

    According to the report of [1], this driver is possible to cause
    the following error in ravb_tx_timeout_work().

    ravb e6800000.ethernet ethernet: failed to switch device to config mode

    This error means that the hardware could not change the state
    from "Operation" to "Configuration" while some tx and/or rx queue
    are operating. After that, ravb_config() in ravb_dmac_init() will fail,
    and then any descriptors will be not allocaled anymore so that NULL
    pointer dereference happens after that on ravb_start_xmit().

    To fix the issue, the ravb_tx_timeout_work() should check
    the return values of ravb_stop_dma() and ravb_dmac_init().
    If ravb_stop_dma() fails, ravb_tx_timeout_work() re-enables TX and RX
    and just exits. If ravb_dmac_init() fails, just exits.

    [1]
    https://lore.kernel.org/linux-renesas-soc/20200518045452.2390-1-dirk.behme@de.bosch.com/

    Reported-by: Dirk Behme
    Signed-off-by: Yoshihiro Shimoda
    Reviewed-by: Sergei Shtylyov
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Yoshihiro Shimoda
     
  • [ Upstream commit 1d61e21852d3161f234b9656797669fe185c251b ]

    This is likely firmware causing this but its starting to annoy customers.
    Change the message level to verbose to prevent the spam.
    Note that this seems to only show up with ISCSI enabled on the HBA via the
    qedi driver.

    Signed-off-by: Laurence Oberman
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Laurence Oberman
     
  • [ Upstream commit e692139e6af339a1495ef401b2d95f7f9d1c7a44 ]

    The function invokes bpf_prog_inc(), which increases the reference
    count of a bpf_prog object "rq->xdp_prog" if the object isn't NULL.

    The refcount leak issues take place in two error handling paths. When
    either mlx5_wq_ll_create() or mlx5_wq_cyc_create() fails, the function
    simply returns the error code and forgets to drop the reference count
    increased earlier, causing a reference count leak of "rq->xdp_prog".

    Fix this issue by jumping to the error handling path err_rq_wq_destroy
    while either function fails.

    Fixes: 422d4c401edd ("net/mlx5e: RX, Split WQ objects for different RQ types")
    Signed-off-by: Xin Xiong
    Signed-off-by: Xiyu Yang
    Signed-off-by: Xin Tan
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Sasha Levin

    Xin Xiong
     
  • [ Upstream commit 85496a29224188051b6135eb38da8afd4c584765 ]

    Fix the missing clk_disable_unprepare() before return
    from gemini_ethernet_port_probe() in the error handling case.

    Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
    Reported-by: Hulk Robot
    Signed-off-by: Wang Hai
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Wang Hai
     
  • [ Upstream commit 366228ed01f6882cc203e3d5b40010dfae0be1c3 ]

    If some processes in nixge_probe() fail, free_netdev(dev)
    needs to be called to aviod a memory leak.

    Fixes: 87ab207981ec ("net: nixge: Separate ctrl and dma resources")
    Fixes: abcd3d6fc640 ("net: nixge: Fix error path for obtaining mac address")
    Reported-by: Hulk Robot
    Signed-off-by: Lu Wei
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Lu Wei
     
  • [ Upstream commit 27a2145d6f826d1fad9de06ac541b1016ced3427 ]

    RX queue IRQ mappings are disposed in both the TX IRQ and RX IRQ
    error paths. Fix this and dispose of TX IRQ mappings correctly in
    case of an error.

    Fixes: ea22d51a7831 ("ibmvnic: simplify and improve driver probe function")
    Signed-off-by: Thomas Falcon
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Thomas Falcon
     
  • [ 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 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
     

01 Aug, 2020

1 commit

  • 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
     

29 Jul, 2020

13 commits

  • [ 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 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 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 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
     

22 Jul, 2020

6 commits

  • commit ef7232da6bcd4294cbb2d424bc35885721570f01 upstream.

    Set up vlan_features for use by any vlans above us.

    Fixes: beead698b173 ("ionic: Add the basic NDO callbacks for netdev support")
    Signed-off-by: Shannon Nelson
    Acked-by: Jonathan Toppins
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Shannon Nelson
     
  • [ Upstream commit 41c2b6b4f0f807803bb49f65835d136941a70f85 ]

    When writing the serdes configuration register was moved to
    mvneta_config_interface() the whole code block was removed from
    mvneta_port_power_up() in the assumption that its only purpose was to
    write the serdes configuration register. As mentioned by Russell King
    its purpose was also to check for valid interface modes early so that
    later in the driver we do not have to care for unexpected interface
    modes.
    Add back the test to let the driver bail out early on unhandled
    interface modes.

    Fixes: b4748553f53f ("net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy")
    Signed-off-by: Sascha Hauer
    Reviewed-by: Russell King
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Sascha Hauer
     
  • [ Upstream commit d3d239dcb8aae6d7b10642d292b404e57604f7ea ]

    In mvneta_config_interface() the RGMII modes are catched by the default
    case which is an error return. The RGMII modes are valid modes for the
    driver, so instead of returning an error add a break statement to return
    successfully.

    This avoids this warning for non comphy SoCs which use RGMII, like
    SolidRun Clearfog:

    WARNING: CPU: 0 PID: 268 at drivers/net/ethernet/marvell/mvneta.c:3512 mvneta_start_dev+0x220/0x23c

    Fixes: b4748553f53f ("net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy")
    Signed-off-by: Sascha Hauer
    Reviewed-by: Russell King
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Sascha Hauer
     
  • [ Upstream commit 0eaf228d574bd82a9aed73e3953bfb81721f4227 ]

    Call pm_runtime_put_sync() on failure path of at91ether_open.

    Fixes: e6a41c23df0d ("net: macb: ensure interface is not suspended on at91rm9200")
    Signed-off-by: Claudiu Beznea
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Sasha Levin
     
  • commit 2a762e9e8cd1cf1242e4269a2244666ed02eecd1 upstream.

    There are two types of the lower interface of rmnet that are VND
    and BRIDGE.
    Each lower interface can have only one type either VND or BRIDGE.
    But, there is a case, which uses both lower interface types.
    Due to this unexpected behavior, lower interface leak occurs.

    Test commands:
    ip link add dummy0 type dummy
    ip link add dummy1 type dummy
    ip link add rmnet0 link dummy0 type rmnet mux_id 1
    ip link set dummy1 master rmnet0
    ip link add rmnet1 link dummy1 type rmnet mux_id 2
    ip link del rmnet0

    The dummy1 was attached as BRIDGE interface of rmnet0.
    Then, it also was attached as VND interface of rmnet1.
    This is unexpected behavior and there is no code for handling this case.
    So that below splat occurs when the rmnet0 interface is deleted.

    Splat looks like:
    [ 53.254112][ C1] WARNING: CPU: 1 PID: 1192 at net/core/dev.c:8992 rollback_registered_many+0x986/0xcf0
    [ 53.254117][ C1] Modules linked in: rmnet dummy openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nfx
    [ 53.254182][ C1] CPU: 1 PID: 1192 Comm: ip Not tainted 5.8.0-rc1+ #620
    [ 53.254188][ C1] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
    [ 53.254192][ C1] RIP: 0010:rollback_registered_many+0x986/0xcf0
    [ 53.254200][ C1] Code: 41 8b 4e cc 45 31 c0 31 d2 4c 89 ee 48 89 df e8 e0 47 ff ff 85 c0 0f 84 cd fc ff ff 0f 0b e5
    [ 53.254205][ C1] RSP: 0018:ffff888050a5f2e0 EFLAGS: 00010287
    [ 53.254214][ C1] RAX: ffff88805756d658 RBX: ffff88804d99c000 RCX: ffffffff8329d323
    [ 53.254219][ C1] RDX: 1ffffffff0be6410 RSI: 0000000000000008 RDI: ffffffff85f32080
    [ 53.254223][ C1] RBP: dffffc0000000000 R08: fffffbfff0be6411 R09: fffffbfff0be6411
    [ 53.254228][ C1] R10: ffffffff85f32087 R11: 0000000000000001 R12: ffff888050a5f480
    [ 53.254233][ C1] R13: ffff88804d99c0b8 R14: ffff888050a5f400 R15: ffff8880548ebe40
    [ 53.254238][ C1] FS: 00007f6b86b370c0(0000) GS:ffff88806c200000(0000) knlGS:0000000000000000
    [ 53.254243][ C1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 53.254248][ C1] CR2: 0000562c62438758 CR3: 000000003f600005 CR4: 00000000000606e0
    [ 53.254253][ C1] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 53.254257][ C1] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [ 53.254261][ C1] Call Trace:
    [ 53.254266][ C1] ? lockdep_hardirqs_on_prepare+0x379/0x540
    [ 53.254270][ C1] ? netif_set_real_num_tx_queues+0x780/0x780
    [ 53.254275][ C1] ? rmnet_unregister_real_device+0x56/0x90 [rmnet]
    [ 53.254279][ C1] ? __kasan_slab_free+0x126/0x150
    [ 53.254283][ C1] ? kfree+0xdc/0x320
    [ 53.254288][ C1] ? rmnet_unregister_real_device+0x56/0x90 [rmnet]
    [ 53.254293][ C1] unregister_netdevice_many.part.135+0x13/0x1b0
    [ 53.254297][ C1] rtnl_delete_link+0xbc/0x100
    [ 53.254301][ C1] ? rtnl_af_register+0xc0/0xc0
    [ 53.254305][ C1] rtnl_dellink+0x2dc/0x840
    [ 53.254309][ C1] ? find_held_lock+0x39/0x1d0
    [ 53.254314][ C1] ? valid_fdb_dump_strict+0x620/0x620
    [ 53.254318][ C1] ? rtnetlink_rcv_msg+0x457/0x890
    [ 53.254322][ C1] ? lock_contended+0xd20/0xd20
    [ 53.254326][ C1] rtnetlink_rcv_msg+0x4a8/0x890
    [ ... ]
    [ 73.813696][ T1192] unregister_netdevice: waiting for rmnet0 to become free. Usage count = 1

    Fixes: 037f9cdf72fb ("net: rmnet: use upper/lower device infrastructure")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Taehee Yoo
     
  • commit a42e6aee7f47a8a68d09923c720fc8f605a04207 upstream.

    This patch fixes ip dst and ipv6 address filters.
    There were 2 mistakes in the code, which led to the issue:
    * invalid register was used for ipv4 dst address;
    * incorrect write order of dwords for ipv6 addresses.

    Fixes: 23e7a718a49b ("net: aquantia: add rx-flow filter definitions")
    Signed-off-by: Dmitry Bogdanov
    Signed-off-by: Mark Starovoytov
    Signed-off-by: Alexander Lobakin
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Bogdanov
     

16 Jul, 2020

3 commits

  • [ Upstream commit c4317b11675b99af6641662ebcbd3c6010600e64 ]

    In case devlink reload failed, it is possible to trigger a
    use-after-free when querying the kernel for device info via 'devlink dev
    info' [1].

    This happens because as part of the reload error path the PCI command
    interface is de-initialized and its mailboxes are freed. When the
    devlink '->info_get()' callback is invoked the device is queried via the
    command interface and the freed mailboxes are accessed.

    Fix this by initializing the command interface once during probe and not
    during every reload.

    This is consistent with the other bus used by mlxsw (i.e., 'mlxsw_i2c')
    and also allows user space to query the running firmware version (for
    example) from the device after a failed reload.

    [1]
    BUG: KASAN: use-after-free in memcpy include/linux/string.h:406 [inline]
    BUG: KASAN: use-after-free in mlxsw_pci_cmd_exec+0x177/0xa60 drivers/net/ethernet/mellanox/mlxsw/pci.c:1675
    Write of size 4096 at addr ffff88810ae32000 by task syz-executor.1/2355

    CPU: 1 PID: 2355 Comm: syz-executor.1 Not tainted 5.8.0-rc2+ #29
    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
    check_memory_region_inline mm/kasan/generic.c:186 [inline]
    check_memory_region+0x14e/0x1b0 mm/kasan/generic.c:192
    memcpy+0x39/0x60 mm/kasan/common.c:106
    memcpy include/linux/string.h:406 [inline]
    mlxsw_pci_cmd_exec+0x177/0xa60 drivers/net/ethernet/mellanox/mlxsw/pci.c:1675
    mlxsw_cmd_exec+0x249/0x550 drivers/net/ethernet/mellanox/mlxsw/core.c:2335
    mlxsw_cmd_access_reg drivers/net/ethernet/mellanox/mlxsw/cmd.h:859 [inline]
    mlxsw_core_reg_access_cmd drivers/net/ethernet/mellanox/mlxsw/core.c:1938 [inline]
    mlxsw_core_reg_access+0x2f6/0x540 drivers/net/ethernet/mellanox/mlxsw/core.c:1985
    mlxsw_reg_query drivers/net/ethernet/mellanox/mlxsw/core.c:2000 [inline]
    mlxsw_devlink_info_get+0x17f/0x6e0 drivers/net/ethernet/mellanox/mlxsw/core.c:1090
    devlink_nl_info_fill.constprop.0+0x13c/0x2d0 net/core/devlink.c:4588
    devlink_nl_cmd_info_get_dumpit+0x246/0x460 net/core/devlink.c:4648
    genl_lock_dumpit+0x85/0xc0 net/netlink/genetlink.c:575
    netlink_dump+0x515/0xe50 net/netlink/af_netlink.c:2245
    __netlink_dump_start+0x53d/0x830 net/netlink/af_netlink.c:2353
    genl_family_rcv_msg_dumpit.isra.0+0x296/0x300 net/netlink/genetlink.c:638
    genl_family_rcv_msg net/netlink/genetlink.c:733 [inline]
    genl_rcv_msg+0x78d/0x9d0 net/netlink/genetlink.c:753
    netlink_rcv_skb+0x152/0x440 net/netlink/af_netlink.c:2469
    genl_rcv+0x24/0x40 net/netlink/genetlink.c:764
    netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
    netlink_unicast+0x53a/0x750 net/netlink/af_netlink.c:1329
    netlink_sendmsg+0x850/0xd90 net/netlink/af_netlink.c:1918
    sock_sendmsg_nosec net/socket.c:652 [inline]
    sock_sendmsg+0x150/0x190 net/socket.c:672
    ____sys_sendmsg+0x6d8/0x840 net/socket.c:2363
    ___sys_sendmsg+0xff/0x170 net/socket.c:2417
    __sys_sendmsg+0xe5/0x1b0 net/socket.c:2450
    do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:359
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Fixes: a9c8336f6544 ("mlxsw: core: Add support for devlink info command")
    Signed-off-by: Ido Schimmel
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Ido Schimmel
     
  • [ Upstream commit d9d5420273997664a1c09151ca86ac993f2f89c1 ]

    We should not trigger a warning when a memory allocation fails. Remove
    the WARN_ON().

    The warning is constantly triggered by syzkaller when it is injecting
    faults:

    [ 2230.758664] FAULT_INJECTION: forcing a failure.
    [ 2230.758664] name failslab, interval 1, probability 0, space 0, times 0
    [ 2230.762329] CPU: 3 PID: 1407 Comm: syz-executor.0 Not tainted 5.8.0-rc2+ #28
    ...
    [ 2230.898175] WARNING: CPU: 3 PID: 1407 at drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:6265 mlxsw_sp_router_fib_event+0xfad/0x13e0
    [ 2230.898179] Kernel panic - not syncing: panic_on_warn set ...
    [ 2230.898183] CPU: 3 PID: 1407 Comm: syz-executor.0 Not tainted 5.8.0-rc2+ #28
    [ 2230.898190] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014

    Fixes: 3057224e014c ("mlxsw: spectrum_router: Implement FIB offload in deferred work")
    Signed-off-by: Ido Schimmel
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Ido Schimmel
     
  • [ Upstream commit 6c8f85cac98a4c6b767c4c4f6af7283724c32b47 ]

    The calls to pm_runtime_force_suspend/resume() functions are only
    relevant if the device is not configured to act as a WoL wakeup source.
    Add the device_may_wakeup() test before calling them.

    Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
    Cc: Claudiu Beznea
    Cc: Harini Katakam
    Cc: Sergio Prado
    Reviewed-by: Florian Fainelli
    Signed-off-by: Nicolas Ferre
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Nicolas Ferre