1. 17 2月, 2021 7 次提交
    • V
      net: enetc: fix destroyed phylink dereference during unbind · 3af409ca
      Vladimir Oltean 提交于
      The following call path suggests that calling unregister_netdev on an
      interface that is up will first bring it down.
      
      enetc_pf_remove
      -> unregister_netdev
         -> unregister_netdevice_queue
            -> unregister_netdevice_many
               -> dev_close_many
                  -> __dev_close_many
                     -> enetc_close
                        -> enetc_stop
                           -> phylink_stop
      
      However, enetc first destroys the phylink instance, then calls
      unregister_netdev. This is already dissimilar to the setup (and error
      path teardown path) from enetc_pf_probe, but more than that, it is buggy
      because it is invalid to call phylink_stop after phylink_destroy.
      
      So let's first unregister the netdev (and let the .ndo_stop events
      consume themselves), then destroy the phylink instance, then free the
      netdev.
      
      Fixes: 71b77a7a ("enetc: Migrate to PHYLINK and PCS_LYNX")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3af409ca
    • V
      net: sched: fix police ext initialization · 396d7f23
      Vlad Buslov 提交于
      When police action is created by cls API tcf_exts_validate() first
      conditional that calls tcf_action_init_1() directly, the action idr is not
      updated according to latest changes in action API that require caller to
      commit newly created action to idr with tcf_idr_insert_many(). This results
      such action not being accessible through act API and causes crash reported
      by syzbot:
      
      ==================================================================
      BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:71 [inline]
      BUG: KASAN: null-ptr-deref in atomic_read include/asm-generic/atomic-instrumented.h:27 [inline]
      BUG: KASAN: null-ptr-deref in __tcf_idr_release net/sched/act_api.c:178 [inline]
      BUG: KASAN: null-ptr-deref in tcf_idrinfo_destroy+0x129/0x1d0 net/sched/act_api.c:598
      Read of size 4 at addr 0000000000000010 by task kworker/u4:5/204
      
      CPU: 0 PID: 204 Comm: kworker/u4:5 Not tainted 5.11.0-rc7-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: netns cleanup_net
      Call Trace:
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x107/0x163 lib/dump_stack.c:120
       __kasan_report mm/kasan/report.c:400 [inline]
       kasan_report.cold+0x5f/0xd5 mm/kasan/report.c:413
       check_memory_region_inline mm/kasan/generic.c:179 [inline]
       check_memory_region+0x13d/0x180 mm/kasan/generic.c:185
       instrument_atomic_read include/linux/instrumented.h:71 [inline]
       atomic_read include/asm-generic/atomic-instrumented.h:27 [inline]
       __tcf_idr_release net/sched/act_api.c:178 [inline]
       tcf_idrinfo_destroy+0x129/0x1d0 net/sched/act_api.c:598
       tc_action_net_exit include/net/act_api.h:151 [inline]
       police_exit_net+0x168/0x360 net/sched/act_police.c:390
       ops_exit_list+0x10d/0x160 net/core/net_namespace.c:190
       cleanup_net+0x4ea/0xb10 net/core/net_namespace.c:604
       process_one_work+0x98d/0x15f0 kernel/workqueue.c:2275
       worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
       kthread+0x3b1/0x4a0 kernel/kthread.c:292
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
      ==================================================================
      Kernel panic - not syncing: panic_on_warn set ...
      CPU: 0 PID: 204 Comm: kworker/u4:5 Tainted: G    B             5.11.0-rc7-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: netns cleanup_net
      Call Trace:
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x107/0x163 lib/dump_stack.c:120
       panic+0x306/0x73d kernel/panic.c:231
       end_report+0x58/0x5e mm/kasan/report.c:100
       __kasan_report mm/kasan/report.c:403 [inline]
       kasan_report.cold+0x67/0xd5 mm/kasan/report.c:413
       check_memory_region_inline mm/kasan/generic.c:179 [inline]
       check_memory_region+0x13d/0x180 mm/kasan/generic.c:185
       instrument_atomic_read include/linux/instrumented.h:71 [inline]
       atomic_read include/asm-generic/atomic-instrumented.h:27 [inline]
       __tcf_idr_release net/sched/act_api.c:178 [inline]
       tcf_idrinfo_destroy+0x129/0x1d0 net/sched/act_api.c:598
       tc_action_net_exit include/net/act_api.h:151 [inline]
       police_exit_net+0x168/0x360 net/sched/act_police.c:390
       ops_exit_list+0x10d/0x160 net/core/net_namespace.c:190
       cleanup_net+0x4ea/0xb10 net/core/net_namespace.c:604
       process_one_work+0x98d/0x15f0 kernel/workqueue.c:2275
       worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
       kthread+0x3b1/0x4a0 kernel/kthread.c:292
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
      Kernel Offset: disabled
      
      Fix the issue by calling tcf_idr_insert_many() after successful action
      initialization.
      
      Fixes: 0fedc63f ("net_sched: commit action insertions together")
      Reported-by: syzbot+151e3e714d34ae4ce7e8@syzkaller.appspotmail.com
      Signed-off-by: NVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      396d7f23
    • D
      Merge branch 'amd-xgbe-fixes' · 17aff538
      David S. Miller 提交于
      Shyam Sundar S K says:
      
      ====================
      Bug fixes to amd-xgbe driver
      
      General fixes on amd-xgbe driver are addressed in this series, mostly
      on the mailbox communication failures and improving the link stability
      of the amd-xgbe device.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      17aff538
    • S
      net: amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP · 9eab3fdb
      Shyam Sundar S K 提交于
      Frequent link up/down events can happen when a Bel Fuse SFP part is
      connected to the amd-xgbe device. Try to avoid the frequent link
      issues by resetting the PHY as documented in Bel Fuse SFP datasheets.
      
      Fixes: e722ec82 ("amd-xgbe: Update the BelFuse quirk to support SGMII")
      Co-developed-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      Acked-by: NTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9eab3fdb
    • S
      net: amd-xgbe: Reset link when the link never comes back · 84fe68eb
      Shyam Sundar S K 提交于
      Normally, auto negotiation and reconnect should be automatically done by
      the hardware. But there seems to be an issue where auto negotiation has
      to be restarted manually. This happens because of link training and so
      even though still connected to the partner the link never "comes back".
      This needs an auto-negotiation restart.
      
      Also, a change in xgbe-mdio is needed to get ethtool to recognize the
      link down and get the link change message. This change is only
      required in a backplane connection mode.
      
      Fixes: abf0a1c2 ("amd-xgbe: Add support for SFP+ modules")
      Co-developed-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      Acked-by: NTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      84fe68eb
    • S
      net: amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning · 186edbb5
      Shyam Sundar S K 提交于
      The current driver calls netif_carrier_off() late in the link tear down
      which can result in a netdev watchdog timeout.
      
      Calling netif_carrier_off() immediately after netif_tx_stop_all_queues()
      avoids the warning.
      
       ------------[ cut here ]------------
       NETDEV WATCHDOG: enp3s0f2 (amd-xgbe): transmit queue 0 timed out
       WARNING: CPU: 3 PID: 0 at net/sched/sch_generic.c:461 dev_watchdog+0x20d/0x220
       Modules linked in: amd_xgbe(E)  amd-xgbe 0000:03:00.2 enp3s0f2: Link is Down
       CPU: 3 PID: 0 Comm: swapper/3 Tainted: G            E
       Hardware name: AMD Bilby-RV2/Bilby-RV2, BIOS RBB1202A 10/18/2019
       RIP: 0010:dev_watchdog+0x20d/0x220
       Code: 00 49 63 4e e0 eb 92 4c 89 e7 c6 05 c6 e2 c1 00 01 e8 e7 ce fc ff 89 d9 48
       RSP: 0018:ffff90cfc28c3e88 EFLAGS: 00010286
       RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
       RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff90cfc28d63c0
       RBP: ffff90cfb977845c R08: 0000000000000050 R09: 0000000000196018
       R10: ffff90cfc28c3ef8 R11: 0000000000000000 R12: ffff90cfb9778000
       R13: 0000000000000003 R14: ffff90cfb9778480 R15: 0000000000000010
       FS:  0000000000000000(0000) GS:ffff90cfc28c0000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007f240ff2d9d0 CR3: 00000001e3e0a000 CR4: 00000000003406e0
       Call Trace:
        <IRQ>
        ? pfifo_fast_reset+0x100/0x100
        call_timer_fn+0x2b/0x130
        run_timer_softirq+0x3e8/0x440
        ? enqueue_hrtimer+0x39/0x90
      
      Fixes: e722ec82 ("amd-xgbe: Update the BelFuse quirk to support SGMII")
      Co-developed-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      Acked-by: NTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      186edbb5
    • S
      net: amd-xgbe: Reset the PHY rx data path when mailbox command timeout · 30b7edc8
      Shyam Sundar S K 提交于
      Sometimes mailbox commands timeout when the RX data path becomes
      unresponsive. This prevents the submission of new mailbox commands to DXIO.
      This patch identifies the timeout and resets the RX data path so that the
      next message can be submitted properly.
      
      Fixes: 549b32af ("amd-xgbe: Simplify mailbox interface rate change code")
      Co-developed-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NSudheesh Mavila <sudheesh.mavila@amd.com>
      Signed-off-by: NShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      Acked-by: NTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      30b7edc8
  2. 16 2月, 2021 11 次提交
    • A
      net: ipa: initialize all resources · 25c5a7e8
      Alex Elder 提交于
      We configure the minimum and maximum number of various types of IPA
      resources in ipa_resource_config().  It iterates over resource types
      in the configuration data and assigns resource limits to each
      resource group for each type.
      
      Unfortunately, we are repeatedly initializing the resource data for
      the first type, rather than initializing each of the types whose
      limits are specified.
      
      Fix this bug.
      
      Fixes: 4a0d7579 ("net: ipa: avoid going past end of resource group array")
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      25c5a7e8
    • S
      ibmvnic: serialize access to work queue on remove · 4a41c421
      Sukadev Bhattiprolu 提交于
      The work queue is used to queue reset requests like CHANGE-PARAM or
      FAILOVER resets for the worker thread. When the adapter is being removed
      the adapter state is set to VNIC_REMOVING and the work queue is flushed
      so no new work is added. However the check for adapter being removed is
      racy in that the adapter can go into REMOVING state just after we check
      and we might end up adding work just as it is being flushed (or after).
      
      The ->rwi_lock is already being used to serialize queue/dequeue work.
      Extend its usage ensure there is no race when scheduling/flushing work.
      
      Fixes: 6954a9e4 ("ibmvnic: Flush existing work items before device removal")
      Signed-off-by: NSukadev Bhattiprolu <sukadev@linux.ibm.com>
      Cc:Uwe Kleine-König <uwe@kleine-koenig.org>
      Cc:Saeed Mahameed <saeed@kernel.org>
      Reviewed-by: NDany Madden <drt@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a41c421
    • L
      ibmvnic: skip send_request_unmap for timeout reset · 7d3a7b9e
      Lijun Pan 提交于
      Timeout reset will trigger the VIOS to unmap it automatically,
      similarly as FAILVOER and MOBILITY events. If we unmap it
      in the linux side, we will see errors like
      "30000003: Error 4 in REQUEST_UNMAP_RSP".
      So, don't call send_request_unmap for timeout reset.
      
      Fixes: ed651a10 ("ibmvnic: Updated reset handling")
      Signed-off-by: NLijun Pan <ljp@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d3a7b9e
    • L
      ibmvnic: add memory barrier to protect long term buffer · 42557dab
      Lijun Pan 提交于
      dma_rmb() barrier is added to load the long term buffer before copying
      it to socket buffer; and dma_wmb() barrier is added to update the
      long term buffer before it being accessed by VIOS (virtual i/o server).
      
      Fixes: 032c5e82 ("Driver for IBM System i/p VNIC protocol")
      Signed-off-by: NLijun Pan <ljp@linux.ibm.com>
      Acked-by: NThomas Falcon <tlfalcon@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      42557dab
    • H
      r8169: fix resuming from suspend on RTL8105e if machine runs on battery · 7ce189fa
      Heiner Kallweit 提交于
      Armin reported that after referenced commit his RTL8105e is dead when
      resuming from suspend and machine runs on battery. This patch has been
      confirmed to fix the issue.
      
      Fixes: e80bd76f ("r8169: work around power-saving bug on some chip versions")
      Reported-by: NArmin Wolf <W_Armin@gmx.de>
      Tested-by: NArmin Wolf <W_Armin@gmx.de>
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7ce189fa
    • S
      net: caif: Use netif_rx_any_context(). · d6d8a240
      Sebastian Andrzej Siewior 提交于
      The usage of in_interrupt() in non-core code is phased out. Ideally the
      information of the calling context should be passed by the callers or the
      functions be split as appropriate.
      
      The attempt to consolidate the code by passing an arguemnt or by
      distangling it failed due lack of knowledge about this driver and because
      the call chains are hard to follow.
      
      As a stop gap use netif_rx_any_context() which invokes the correct code path
      depending on context and confines the in_interrupt() usage to core code.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d6d8a240
    • T
      net: wan/lmc: dont print format string when not available · a67f0616
      Tong Zhang 提交于
      dev->name is determined only after calling register_hdlc_device(),
      however ,it is used by printk before the name is fully determined.
      
        [    4.565137] hdlc%d: detected at e8000000, irq 11
      
      Instead of printing out a %d, print hdlc directly
      Signed-off-by: NTong Zhang <ztong0001@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a67f0616
    • T
      net: wan/lmc: unregister device when no matching device is found · 62e69bc4
      Tong Zhang 提交于
      lmc set sc->lmc_media pointer when there is a matching device.
      However, when no matching device is found, this pointer is NULL
      and the following dereference will result in a null-ptr-deref.
      
      To fix this issue, unregister the hdlc device and return an error.
      
      [    4.569359] BUG: KASAN: null-ptr-deref in lmc_init_one.cold+0x2b6/0x55d [lmc]
      [    4.569748] Read of size 8 at addr 0000000000000008 by task modprobe/95
      [    4.570102]
      [    4.570187] CPU: 0 PID: 95 Comm: modprobe Not tainted 5.11.0-rc7 #94
      [    4.570527] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-48-gd9c812dda519-preb4
      [    4.571125] Call Trace:
      [    4.571261]  dump_stack+0x7d/0xa3
      [    4.571445]  kasan_report.cold+0x10c/0x10e
      [    4.571667]  ? lmc_init_one.cold+0x2b6/0x55d [lmc]
      [    4.571932]  lmc_init_one.cold+0x2b6/0x55d [lmc]
      [    4.572186]  ? lmc_mii_readreg+0xa0/0xa0 [lmc]
      [    4.572432]  local_pci_probe+0x6f/0xb0
      [    4.572639]  pci_device_probe+0x171/0x240
      [    4.572857]  ? pci_device_remove+0xe0/0xe0
      [    4.573080]  ? kernfs_create_link+0xb6/0x110
      [    4.573315]  ? sysfs_do_create_link_sd.isra.0+0x76/0xe0
      [    4.573598]  really_probe+0x161/0x420
      [    4.573799]  driver_probe_device+0x6d/0xd0
      [    4.574022]  device_driver_attach+0x82/0x90
      [    4.574249]  ? device_driver_attach+0x90/0x90
      [    4.574485]  __driver_attach+0x60/0x100
      [    4.574694]  ? device_driver_attach+0x90/0x90
      [    4.574931]  bus_for_each_dev+0xe1/0x140
      [    4.575146]  ? subsys_dev_iter_exit+0x10/0x10
      [    4.575387]  ? klist_node_init+0x61/0x80
      [    4.575602]  bus_add_driver+0x254/0x2a0
      [    4.575812]  driver_register+0xd3/0x150
      [    4.576021]  ? 0xffffffffc0018000
      [    4.576202]  do_one_initcall+0x84/0x250
      [    4.576411]  ? trace_event_raw_event_initcall_finish+0x150/0x150
      [    4.576733]  ? unpoison_range+0xf/0x30
      [    4.576938]  ? ____kasan_kmalloc.constprop.0+0x84/0xa0
      [    4.577219]  ? unpoison_range+0xf/0x30
      [    4.577423]  ? unpoison_range+0xf/0x30
      [    4.577628]  do_init_module+0xf8/0x350
      [    4.577833]  load_module+0x3fe6/0x4340
      [    4.578038]  ? vm_unmap_ram+0x1d0/0x1d0
      [    4.578247]  ? ____kasan_kmalloc.constprop.0+0x84/0xa0
      [    4.578526]  ? module_frob_arch_sections+0x20/0x20
      [    4.578787]  ? __do_sys_finit_module+0x108/0x170
      [    4.579037]  __do_sys_finit_module+0x108/0x170
      [    4.579278]  ? __ia32_sys_init_module+0x40/0x40
      [    4.579523]  ? file_open_root+0x200/0x200
      [    4.579742]  ? do_sys_open+0x85/0xe0
      [    4.579938]  ? filp_open+0x50/0x50
      [    4.580125]  ? exit_to_user_mode_prepare+0xfc/0x130
      [    4.580390]  do_syscall_64+0x33/0x40
      [    4.580586]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [    4.580859] RIP: 0033:0x7f1a724c3cf7
      [    4.581054] Code: 48 89 57 30 48 8b 04 24 48 89 47 38 e9 1d a0 02 00 48 89 f8 48 89 f7 48 89 d6 48 891
      [    4.582043] RSP: 002b:00007fff44941c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      [    4.582447] RAX: ffffffffffffffda RBX: 00000000012ada70 RCX: 00007f1a724c3cf7
      [    4.582827] RDX: 0000000000000000 RSI: 00000000012ac9e0 RDI: 0000000000000003
      [    4.583207] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000001
      [    4.583587] R10: 00007f1a72527300 R11: 0000000000000246 R12: 00000000012ac9e0
      [    4.583968] R13: 0000000000000000 R14: 00000000012acc90 R15: 0000000000000001
      [    4.584349] ==================================================================
      Signed-off-by: NTong Zhang <ztong0001@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62e69bc4
    • C
      b43: N-PHY: Fix the update of coef for the PHY revision >= 3case · 4773acf3
      Colin Ian King 提交于
      The documentation for the PHY update [1] states:
      
      Loop 4 times with index i
      
          If PHY Revision >= 3
              Copy table[i] to coef[i]
          Otherwise
              Set coef[i] to 0
      
      the copy of the table to coef is currently implemented the wrong way
      around, table is being updated from uninitialized values in coeff.
      Fix this by swapping the assignment around.
      
      [1] https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal/
      
      Fixes: 2f258b74 ("b43: N-PHY: implement restoring general configuration")
      Addresses-Coverity: ("Uninitialized scalar variable")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Acked-by: NLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4773acf3
    • A
      cxgb4/chtls/cxgbit: Keeping the max ofld immediate data size same in cxgb4 and ulds · 2355a677
      Ayush Sawal 提交于
      The Max imm data size in cxgb4 is not similar to the max imm data size
      in the chtls. This caused an mismatch in output of is_ofld_imm() of
      cxgb4 and chtls. So fixed this by keeping the max wreq size of imm data
      same in both chtls and cxgb4 as MAX_IMM_OFLD_TX_DATA_WR_LEN.
      
      As cxgb4's max imm. data value for ofld packets is changed to
      MAX_IMM_OFLD_TX_DATA_WR_LEN. Using the same in cxgbit also.
      
      Fixes: 36bedb3f ("crypto: chtls - Inline TLS record Tx")
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2355a677
    • T
      atm: idt77252: fix build broken on amd64 · d0a0bbe7
      Tong Zhang 提交于
      idt77252 is broken and wont load on amd64 systems
        modprobe idt77252 shows the following
      
          idt77252_init: skb->cb is too small (48 < 56)
      
        Add packed attribute to struct idt77252_skb_prv and struct atm_skb_data
        so that the total size can be <= sizeof(skb->cb)
        Also convert runtime size check to buildtime size check in
        idt77252_init()
      Signed-off-by: NTong Zhang <ztong0001@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0a0bbe7
  3. 13 2月, 2021 6 次提交
    • R
      net: axienet: Handle deferred probe on clock properly · 57baf8cc
      Robert Hancock 提交于
      This driver is set up to use a clock mapping in the device tree if it is
      present, but still work without one for backward compatibility. However,
      if getting the clock returns -EPROBE_DEFER, then we need to abort and
      return that error from our driver initialization so that the probe can
      be retried later after the clock is set up.
      
      Move clock initialization to earlier in the process so we do not waste as
      much effort if the clock is not yet available. Switch to use
      devm_clk_get_optional and abort initialization on any error reported.
      Also enable the clock regardless of whether the controller is using an MDIO
      bus, as the clock is required in any case.
      
      Fixes: 09a0354c ("net: axienet: Use clock framework to get device clock rate")
      Signed-off-by: NRobert Hancock <robert.hancock@calian.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      57baf8cc
    • D
      ibmvnic: change IBMVNIC_MAX_IND_DESCS to 16 · a6f2fe5f
      Dany Madden 提交于
      The supported indirect subcrq entries on Power8 is 16. Power9
      supports 128. Redefined this value to 16 to minimize the driver from
      having to reset when migrating between Power9 and Power8. In our rx/tx
      performance testing, we found no performance difference between 16 and
      128 at this time.
      
      Fixes: f019fb63 ("ibmvnic: Introduce indirect subordinate Command Response Queue buffer")
      Signed-off-by: NDany Madden <drt@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a6f2fe5f
    • D
      flow_dissector: fix TTL and TOS dissection on IPv4 fragments · d2126838
      Davide Caratti 提交于
      the following command:
      
       # tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
         $tcflags dst_ip 192.0.2.2 ip_ttl 63 action drop
      
      doesn't drop all IPv4 packets that match the configured TTL / destination
      address. In particular, if "fragment offset" or "more fragments" have non
      zero value in the IPv4 header, setting of FLOW_DISSECTOR_KEY_IP is simply
      ignored. Fix this dissecting IPv4 TTL and TOS before fragment info; while
      at it, add a selftest for tc flower's match on 'ip_ttl' that verifies the
      correct behavior.
      
      Fixes: 518d8a2e ("net/flow_dissector: add support for dissection of misc ip header fields")
      Reported-by: NShuang Li <shuali@redhat.com>
      Signed-off-by: NDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d2126838
    • D
      appletalk: Fix skb allocation size in loopback case · 39935dcc
      Doug Brown 提交于
      If a DDP broadcast packet is sent out to a non-gateway target, it is
      also looped back. There is a potential for the loopback device to have a
      longer hardware header length than the original target route's device,
      which can result in the skb not being created with enough room for the
      loopback device's hardware header. This patch fixes the issue by
      determining that a loopback will be necessary prior to allocating the
      skb, and if so, ensuring the skb has enough room.
      
      This was discovered while testing a new driver that creates a LocalTalk
      network interface (LTALK_HLEN = 1). It caused an skb_under_panic.
      Signed-off-by: NDoug Brown <doug@schmorgal.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      39935dcc
    • D
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 0c9fc2ed
      David S. Miller 提交于
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2021-02-13
      
      The following pull-request contains BPF updates for your *net* tree.
      
      We've added 2 non-merge commits during the last 3 day(s) which contain
      a total of 2 files changed, 9 insertions(+), 11 deletions(-).
      
      The main changes are:
      
      1) Fix mod32 truncation handling in verifier, from Daniel Borkmann.
      
      2) Fix XDP redirect tests to explicitly use bash, from Björn Töpel.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c9fc2ed
    • D
      bpf: Fix truncation handling for mod32 dst reg wrt zero · 9b00f1b7
      Daniel Borkmann 提交于
      Recently noticed that when mod32 with a known src reg of 0 is performed,
      then the dst register is 32-bit truncated in verifier:
      
        0: R1=ctx(id=0,off=0,imm=0) R10=fp0
        0: (b7) r0 = 0
        1: R0_w=inv0 R1=ctx(id=0,off=0,imm=0) R10=fp0
        1: (b7) r1 = -1
        2: R0_w=inv0 R1_w=inv-1 R10=fp0
        2: (b4) w2 = -1
        3: R0_w=inv0 R1_w=inv-1 R2_w=inv4294967295 R10=fp0
        3: (9c) w1 %= w0
        4: R0_w=inv0 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0
        4: (b7) r0 = 1
        5: R0_w=inv1 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0
        5: (1d) if r1 == r2 goto pc+1
         R0_w=inv1 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0
        6: R0_w=inv1 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0
        6: (b7) r0 = 2
        7: R0_w=inv2 R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2_w=inv4294967295 R10=fp0
        7: (95) exit
        7: R0=inv1 R1=inv(id=0,umin_value=4294967295,umax_value=4294967295,var_off=(0x0; 0xffffffff)) R2=inv4294967295 R10=fp0
        7: (95) exit
      
      However, as a runtime result, we get 2 instead of 1, meaning the dst
      register does not contain (u32)-1 in this case. The reason is fairly
      straight forward given the 0 test leaves the dst register as-is:
      
        # ./bpftool p d x i 23
         0: (b7) r0 = 0
         1: (b7) r1 = -1
         2: (b4) w2 = -1
         3: (16) if w0 == 0x0 goto pc+1
         4: (9c) w1 %= w0
         5: (b7) r0 = 1
         6: (1d) if r1 == r2 goto pc+1
         7: (b7) r0 = 2
         8: (95) exit
      
      This was originally not an issue given the dst register was marked as
      completely unknown (aka 64 bit unknown). However, after 468f6eaf
      ("bpf: fix 32-bit ALU op verification") the verifier casts the register
      output to 32 bit, and hence it becomes 32 bit unknown. Note that for
      the case where the src register is unknown, the dst register is marked
      64 bit unknown. After the fix, the register is truncated by the runtime
      and the test passes:
      
        # ./bpftool p d x i 23
         0: (b7) r0 = 0
         1: (b7) r1 = -1
         2: (b4) w2 = -1
         3: (16) if w0 == 0x0 goto pc+2
         4: (9c) w1 %= w0
         5: (05) goto pc+1
         6: (bc) w1 = w1
         7: (b7) r0 = 1
         8: (1d) if r1 == r2 goto pc+1
         9: (b7) r0 = 2
        10: (95) exit
      
      Semantics also match with {R,W}x mod{64,32} 0 -> {R,W}x. Invalid div
      has always been {R,W}x div{64,32} 0 -> 0. Rewrites are as follows:
      
        mod32:                            mod64:
      
        (16) if w0 == 0x0 goto pc+2       (15) if r0 == 0x0 goto pc+1
        (9c) w1 %= w0                     (9f) r1 %= r0
        (05) goto pc+1
        (bc) w1 = w1
      
      Fixes: 468f6eaf ("bpf: fix 32-bit ALU op verification")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: NJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      9b00f1b7
  4. 12 2月, 2021 16 次提交