1. 12 Jun, 2023 6 commits
    • Vinicius Costa Gomes's avatar
      igc: Fix possible system crash when loading module · c080fe26
      Vinicius Costa Gomes authored
      Guarantee that when probe() is run again, PTM and PCI busmaster will be
      in the same state as it was if the driver was never loaded.
      
      Avoid an i225/i226 hardware issue that PTM requests can be made even
      though PCI bus mastering is not enabled. These unexpected PTM requests
      can crash some systems.
      
      So, "force" disable PTM and busmastering before removing the driver,
      so they can be re-enabled in the right order during probe(). This is
      more like a workaround and should be applicable for i225 and i226, in
      any platform.
      
      Fixes: 1b5d73fb ("igc: Enable PCIe PTM")
      Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
      Reviewed-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
      Tested-by: default avatarNaama Meir <naamax.meir@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      c080fe26
    • Muhammad Husaini Zulkifli's avatar
      igc: Clean the TX buffer and TX descriptor ring · e43516f5
      Muhammad Husaini Zulkifli authored
      There could be a race condition during link down where interrupt
      being generated and igc_clean_tx_irq() been called to perform the
      TX completion. Properly clear the TX buffer/descriptor ring and
      disable the TX Queue ring in igc_free_tx_resources() to avoid that.
      
      Kernel trace:
      [  108.237177] Hardware name: Intel Corporation Tiger Lake Client Platform/TigerLake U DDR4 SODIMM RVP, BIOS TGLIFUI1.R00.4204.A00.2105270302 05/27/2021
      [  108.237178] RIP: 0010:refcount_warn_saturate+0x55/0x110
      [  108.242143] RSP: 0018:ffff9e7980003db0 EFLAGS: 00010286
      [  108.245555] Code: 84 bc 00 00 00 c3 cc cc cc cc 85 f6 74 46 80 3d 20 8c 4d 01 00 75 ee 48 c7 c7 88 f4 03 ab c6 05 10 8c 4d 01 01 e8 0b 10 96 ff <0f> 0b c3 cc cc cc cc 80 3d fc 8b 4d 01 00 75 cb 48 c7 c7 b0 f4 03
      [  108.250434]
      [  108.250434] RSP: 0018:ffff9e798125f910 EFLAGS: 00010286
      [  108.254358] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      [  108.259325]
      [  108.259325] RAX: 0000000000000000 RBX: ffff8ddb935b8000 RCX: 0000000000000027
      [  108.261868] RDX: ffff8de250a28800 RSI: ffff8de250a1c580 RDI: ffff8de250a1c580
      [  108.265538] RDX: 0000000000000027 RSI: 0000000000000002 RDI: ffff8de250a9c588
      [  108.265539] RBP: ffff8ddb935b8000 R08: ffffffffab2655a0 R09: ffff9e798125f898
      [  108.267914] RBP: ffff8ddb8a5b8d80 R08: 0000005648eba354 R09: 0000000000000000
      [  108.270196] R10: 0000000000000001 R11: 000000002d2d2d2d R12: ffff9e798125f948
      [  108.270197] R13: ffff9e798125fa1c R14: ffff8ddb8a5b8d80 R15: 7fffffffffffffff
      [  108.273001] R10: 000000002d2d2d2d R11: 000000002d2d2d2d R12: ffff8ddb8a5b8ed4
      [  108.276410] FS:  00007f605851b740(0000) GS:ffff8de250a80000(0000) knlGS:0000000000000000
      [  108.280597] R13: 00000000000002ac R14: 00000000ffffff99 R15: ffff8ddb92561b80
      [  108.282966] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  108.282967] CR2: 00007f053c039248 CR3: 0000000185850003 CR4: 0000000000f70ee0
      [  108.286206] FS:  0000000000000000(0000) GS:ffff8de250a00000(0000) knlGS:0000000000000000
      [  108.289701] PKRU: 55555554
      [  108.289702] Call Trace:
      [  108.289704]  <TASK>
      [  108.293977] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  108.297562]  sock_alloc_send_pskb+0x20c/0x240
      [  108.301494] CR2: 00007f053c03a168 CR3: 0000000184394002 CR4: 0000000000f70ef0
      [  108.301495] PKRU: 55555554
      [  108.306464]  __ip_append_data.isra.0+0x96f/0x1040
      [  108.309441] Call Trace:
      [  108.309443]  ? __pfx_ip_generic_getfrag+0x10/0x10
      [  108.314927]  <IRQ>
      [  108.314928]  sock_wfree+0x1c7/0x1d0
      [  108.318078]  ? __pfx_ip_generic_getfrag+0x10/0x10
      [  108.320276]  skb_release_head_state+0x32/0x90
      [  108.324812]  ip_make_skb+0xf6/0x130
      [  108.327188]  skb_release_all+0x16/0x40
      [  108.330775]  ? udp_sendmsg+0x9f3/0xcb0
      [  108.332626]  napi_consume_skb+0x48/0xf0
      [  108.334134]  ? xfrm_lookup_route+0x23/0xb0
      [  108.344285]  igc_poll+0x787/0x1620 [igc]
      [  108.346659]  udp_sendmsg+0x9f3/0xcb0
      [  108.360010]  ? ttwu_do_activate+0x40/0x220
      [  108.365237]  ? __pfx_ip_generic_getfrag+0x10/0x10
      [  108.366744]  ? try_to_wake_up+0x289/0x5e0
      [  108.376987]  ? sock_sendmsg+0x81/0x90
      [  108.395698]  ? __pfx_process_timeout+0x10/0x10
      [  108.395701]  sock_sendmsg+0x81/0x90
      [  108.409052]  __napi_poll+0x29/0x1c0
      [  108.414279]  ____sys_sendmsg+0x284/0x310
      [  108.419507]  net_rx_action+0x257/0x2d0
      [  108.438216]  ___sys_sendmsg+0x7c/0xc0
      [  108.439723]  __do_softirq+0xc1/0x2a8
      [  108.444950]  ? finish_task_switch+0xb4/0x2f0
      [  108.452077]  irq_exit_rcu+0xa9/0xd0
      [  108.453584]  ? __schedule+0x372/0xd00
      [  108.460713]  common_interrupt+0x84/0xa0
      [  108.467840]  ? clockevents_program_event+0x95/0x100
      [  108.474968]  </IRQ>
      [  108.482096]  ? do_nanosleep+0x88/0x130
      [  108.489224]  <TASK>
      [  108.489225]  asm_common_interrupt+0x26/0x40
      [  108.496353]  ? __rseq_handle_notify_resume+0xa9/0x4f0
      [  108.503478] RIP: 0010:cpu_idle_poll+0x2c/0x100
      [  108.510607]  __sys_sendmsg+0x5d/0xb0
      [  108.518687] Code: 05 e1 d9 c8 00 65 8b 15 de 64 85 55 85 c0 7f 57 e8 b9 ef ff ff fb 65 48 8b 1c 25 00 cc 02 00 48 8b 03 a8 08 74 0b eb 1c f3 90 <48> 8b 03 a8 08 75 13 8b 05 77 63 cd 00 85 c0 75 ed e8 ce ec ff ff
      [  108.525817]  do_syscall_64+0x44/0xa0
      [  108.531563] RSP: 0018:ffffffffab203e70 EFLAGS: 00000202
      [  108.538693]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      [  108.546775]
      [  108.546777] RIP: 0033:0x7f605862b7f7
      [  108.549495] RAX: 0000000000000001 RBX: ffffffffab20c940 RCX: 000000000000003b
      [  108.551955] Code: 0e 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
      [  108.554068] RDX: 4000000000000000 RSI: 000000002da97f6a RDI: 00000000002b8ff4
      [  108.559816] RSP: 002b:00007ffc99264058 EFLAGS: 00000246
      [  108.564178] RBP: 0000000000000000 R08: 00000000002b8ff4 R09: ffff8ddb01554c80
      [  108.571302]  ORIG_RAX: 000000000000002e
      [  108.571303] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f605862b7f7
      [  108.574023] R10: 000000000000015b R11: 000000000000000f R12: ffffffffab20c940
      [  108.574024] R13: 0000000000000000 R14: ffff8de26fbeef40 R15: ffffffffab20c940
      [  108.578727] RDX: 0000000000000000 RSI: 00007ffc992640a0 RDI: 0000000000000003
      [  108.578728] RBP: 00007ffc99264110 R08: 0000000000000000 R09: 175f48ad1c3a9c00
      [  108.581187]  do_idle+0x62/0x230
      [  108.585890] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc992642d8
      [  108.585891] R13: 00005577814ab2ba R14: 00005577814addf0 R15: 00007f605876d000
      [  108.587920]  cpu_startup_entry+0x1d/0x20
      [  108.591422]  </TASK>
      [  108.596127]  rest_init+0xc5/0xd0
      [  108.600490] ---[ end trace 0000000000000000 ]---
      
      Test Setup:
      
      DUT:
      - Change mac address on DUT Side. Ensure NIC not having same MAC Address
      - Running udp_tai on DUT side. Let udp_tai running throughout the test
      
      Example:
      ./udp_tai -i enp170s0 -P 100000 -p 90 -c 1 -t 0 -u 30004
      
      Host:
      - Perform link up/down every 5 second.
      
      Result:
      Kernel panic will happen on DUT Side.
      
      Fixes: 13b5b7fd ("igc: Add support for Tx/Rx rings")
      Signed-off-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
      Tested-by: default avatarNaama Meir <naamax.meir@linux.intel.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      e43516f5
    • Dan Carpenter's avatar
      sctp: fix an error code in sctp_sf_eat_auth() · 75e6def3
      Dan Carpenter authored
      The sctp_sf_eat_auth() function is supposed to enum sctp_disposition
      values and returning a kernel error code will cause issues in the
      caller.  Change -ENOMEM to SCTP_DISPOSITION_NOMEM.
      
      Fixes: 65b07e5d ("[SCTP]: API updates to suport SCTP-AUTH extensions.")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Acked-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      75e6def3
    • Dan Carpenter's avatar
      sctp: handle invalid error codes without calling BUG() · a0067dfc
      Dan Carpenter authored
      The sctp_sf_eat_auth() function is supposed to return enum sctp_disposition
      values but if the call to sctp_ulpevent_make_authkey() fails, it returns
      -ENOMEM.
      
      This results in calling BUG() inside the sctp_side_effects() function.
      Calling BUG() is an over reaction and not helpful.  Call WARN_ON_ONCE()
      instead.
      
      This code predates git.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a0067dfc
    • Hangbin Liu's avatar
      ipvlan: fix bound dev checking for IPv6 l3s mode · ce57adc2
      Hangbin Liu authored
      The commit 59a0b022 ("ipvlan: Make skb->skb_iif track skb->dev for l3s
      mode") fixed ipvlan bonded dev checking by updating skb skb_iif. This fix
      works for IPv4, as in raw_v4_input() the dif is from inet_iif(skb), which
      is skb->skb_iif when there is no route.
      
      But for IPv6, the fix is not enough, because in ipv6_raw_deliver() ->
      raw_v6_match(), the dif is inet6_iif(skb), which is returns IP6CB(skb)->iif
      instead of skb->skb_iif if it's not a l3_slave. To fix the IPv6 part
      issue. Let's set IP6CB(skb)->iif to correct ifindex.
      
      BTW, ipvlan handles NS/NA specifically. Since it works fine, I will not
      reset IP6CB(skb)->iif when addr->atype is IPVL_ICMPV6.
      
      Fixes: c675e06a ("ipvlan: decouple l3s mode dependencies from other modes")
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=2196710Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce57adc2
    • Jakub Kicinski's avatar
      net: ethtool: correct MAX attribute value for stats · 52f79609
      Jakub Kicinski authored
      When compiling YNL generated code compiler complains about
      array-initializer-out-of-bounds. Turns out the MAX value
      for STATS_GRP uses the value for STATS.
      
      This may lead to random corruptions in user space (kernel
      itself doesn't use this value as it never parses stats).
      
      Fixes: f09ea6fb ("ethtool: add a new command for reading standard stats")
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52f79609
  2. 10 Jun, 2023 23 commits
  3. 09 Jun, 2023 8 commits
  4. 08 Jun, 2023 3 commits
    • Wei Fang's avatar
      net: enetc: correct the indexes of highest and 2nd highest TCs · 21225873
      Wei Fang authored
      For ENETC hardware, the TCs are numbered from 0 to N-1, where N
      is the number of TCs. Numerically higher TC has higher priority.
      It's obvious that the highest priority TC index should be N-1 and
      the 2nd highest priority TC index should be N-2.
      
      However, the previous logic uses netdev_get_prio_tc_map() to get
      the indexes of highest priority and 2nd highest priority TCs, it
      does not make sense and is incorrect to give a "tc" argument to
      netdev_get_prio_tc_map(). So the driver may get the wrong indexes
      of the two highest priotiry TCs which would lead to failed to set
      the CBS for the two highest priotiry TCs.
      
      e.g.
      $ tc qdisc add dev eno0 parent root handle 100: mqprio num_tc 6 \
      	map 0 0 1 1 2 3 4 5 queues 1@0 1@1 1@2 1@3 2@4 2@6 hw 1
      $ tc qdisc replace dev eno0 parent 100:6 cbs idleslope 100000 \
      	sendslope -900000 hicredit 12 locredit -113 offload 1
      $ Error: Specified device failed to setup cbs hardware offload.
        ^^^^^
      
      In this example, the previous logic deems the indexes of the two
      highest priotiry TCs should be 3 and 2. Actually, the indexes are
      5 and 4, because the number of TCs is 6. So it would be failed to
      configure the CBS for the two highest priority TCs.
      
      Fixes: c431047c ("enetc: add support Credit Based Shaper(CBS) for hardware offload")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      21225873
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: incorrect error path handling with NFT_MSG_NEWRULE · 1240eb93
      Pablo Neira Ayuso authored
      In case of error when adding a new rule that refers to an anonymous set,
      deactivate expressions via NFT_TRANS_PREPARE state, not NFT_TRANS_RELEASE.
      Thus, the lookup expression marks anonymous sets as inactive in the next
      generation to ensure it is not reachable in this transaction anymore and
      decrement the set refcount as introduced by c1592a89 ("netfilter:
      nf_tables: deactivate anonymous set from preparation phase"). The abort
      step takes care of undoing the anonymous set.
      
      This is also consistent with rule deletion, where NFT_TRANS_PREPARE is
      used. Note that this error path is exercised in the preparation step of
      the commit protocol. This patch replaces nf_tables_rule_release() by the
      deactivate and destroy calls, this time with NFT_TRANS_PREPARE.
      
      Due to this incorrect error handling, it is possible to access a
      dangling pointer to the anonymous set that remains in the transaction
      list.
      
      [1009.379054] BUG: KASAN: use-after-free in nft_set_lookup_global+0x147/0x1a0 [nf_tables]
      [1009.379106] Read of size 8 at addr ffff88816c4c8020 by task nft-rule-add/137110
      [1009.379116] CPU: 7 PID: 137110 Comm: nft-rule-add Not tainted 6.4.0-rc4+ #256
      [1009.379128] Call Trace:
      [1009.379132]  <TASK>
      [1009.379135]  dump_stack_lvl+0x33/0x50
      [1009.379146]  ? nft_set_lookup_global+0x147/0x1a0 [nf_tables]
      [1009.379191]  print_address_description.constprop.0+0x27/0x300
      [1009.379201]  kasan_report+0x107/0x120
      [1009.379210]  ? nft_set_lookup_global+0x147/0x1a0 [nf_tables]
      [1009.379255]  nft_set_lookup_global+0x147/0x1a0 [nf_tables]
      [1009.379302]  nft_lookup_init+0xa5/0x270 [nf_tables]
      [1009.379350]  nf_tables_newrule+0x698/0xe50 [nf_tables]
      [1009.379397]  ? nf_tables_rule_release+0xe0/0xe0 [nf_tables]
      [1009.379441]  ? kasan_unpoison+0x23/0x50
      [1009.379450]  nfnetlink_rcv_batch+0x97c/0xd90 [nfnetlink]
      [1009.379470]  ? nfnetlink_rcv_msg+0x480/0x480 [nfnetlink]
      [1009.379485]  ? __alloc_skb+0xb8/0x1e0
      [1009.379493]  ? __alloc_skb+0xb8/0x1e0
      [1009.379502]  ? entry_SYSCALL_64_after_hwframe+0x46/0xb0
      [1009.379509]  ? unwind_get_return_address+0x2a/0x40
      [1009.379517]  ? write_profile+0xc0/0xc0
      [1009.379524]  ? avc_lookup+0x8f/0xc0
      [1009.379532]  ? __rcu_read_unlock+0x43/0x60
      
      Fixes: 958bee14 ("netfilter: nf_tables: use new transaction infrastructure to handle sets")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      1240eb93
    • Kamil Maziarz's avatar
      ice: Fix XDP memory leak when NIC is brought up and down · 78c50d69
      Kamil Maziarz authored
      Fix the buffer leak that occurs while switching
      the port up and down with traffic and XDP by
      checking for an active XDP program and freeing all empty TX buffers.
      
      Fixes: efc2214b ("ice: Add support for XDP")
      Signed-off-by: default avatarKamil Maziarz <kamil.maziarz@intel.com>
      Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
      Acked-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      78c50d69