Skip to content
  1. Nov 09, 2022
    • Jakub Kicinski's avatar
      Merge tag 'linux-can-fixes-for-6.1-20221107' of... · 2b014503
      Jakub Kicinski authored
      
      Merge tag 'linux-can-fixes-for-6.1-20221107' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      can 2022-11-07
      
      The first patch is by Chen Zhongjin and adds a missing
      dev_remove_pack() to the AF_CAN protocol.
      
      Zhengchao Shao's patch fixes a potential NULL pointer deref in
      AF_CAN's can_rx_register().
      
      The next patch is by Oliver Hartkopp and targets the CAN ISO-TP
      protocol, and fixes the state handling for echo TX processing.
      
      Oliver Hartkopp's patch for the j1939 protocol adds a missing
      initialization of the CAN headers inside outgoing skbs.
      
      Another patch by Oliver Hartkopp fixes an out of bounds read in the
      check for invalid CAN frames in the xmit callback of virtual CAN
      devices. This touches all non virtual device drivers as we decided to
      rename the function requiring that netdev_priv points to a struct
      can_priv.
      (Note: This patch will create a merge conflict with net-next where the
       pch_can driver has removed.)
      
      The last patch is by Geert Uytterhoeven and adds the missing ECC error
      checks for the channels 2-7 in the rcar_canfd driver.
      
      * tag 'linux-can-fixes-for-6.1-20221107' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
        can: rcar_canfd: Add missing ECC error checks for channels 2-7
        can: dev: fix skb drop check
        can: j1939: j1939_send_one(): fix missing CAN header initialization
        can: isotp: fix tx state handling for echo tx processing
        can: af_can: fix NULL pointer dereference in can_rx_register()
        can: af_can: can_exit(): add missing dev_remove_pack() of canxl_packet
      ====================
      
      Link: https://lore.kernel.org/r/20221107133217.59861-1-mkl@pengutronix.de
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2b014503
  2. Nov 08, 2022
    • Zhengchao Shao's avatar
      drivers: net: xgene: disable napi when register irq failed in xgene_enet_open() · ce9e57fe
      Zhengchao Shao authored
      When failed to register irq in xgene_enet_open() for opening device,
      napi isn't disabled. When open xgene device next time, it will reports
      a invalid opcode issue. Fix it. Only be compiled, not be tested.
      
      Fixes: aeb20b6b
      
       ("drivers: net: xgene: fix: ifconfig up/down crash")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Link: https://lore.kernel.org/r/20221107043032.357673-1-shaozhengchao@huawei.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ce9e57fe
    • Ratheesh Kannoth's avatar
      octeontx2-pf: Fix SQE threshold checking · f0dfc4c8
      Ratheesh Kannoth authored
      Current way of checking available SQE count which is based on
      HW updated SQB count could result in driver submitting an SQE
      even before CQE for the previously transmitted SQE at the same
      index is processed in NAPI resulting losing SKB pointers,
      hence a leak. Fix this by checking a consumer index which
      is updated once CQE is processed.
      
      Fixes: 3ca6c4c8
      
       ("octeontx2-pf: Add packet transmission support")
      Signed-off-by: default avatarRatheesh Kannoth <rkannoth@marvell.com>
      Reviewed-by: default avatarSunil Kovvuri Goutham <sgoutham@marvell.com>
      Link: https://lore.kernel.org/r/20221107033505.2491464-1-rkannoth@marvell.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      f0dfc4c8
    • Zhengchao Shao's avatar
      net: ethernet: mtk-star-emac: disable napi when connect and start PHY failed in mtk_star_enable() · b0c09c7f
      Zhengchao Shao authored
      When failed to connect to and start PHY in mtk_star_enable() for opening
      device, napi isn't disabled. When open mtk star device next time, it will
      reports a invalid opcode issue. Fix it. Only be compiled, not be tested.
      
      Fixes: 8c7bd5a4
      
       ("net: ethernet: mtk-star-emac: new driver")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Link: https://lore.kernel.org/r/20221107012159.211387-1-shaozhengchao@huawei.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b0c09c7f
    • Zhengchao Shao's avatar
      net: lapbether: fix issue of invalid opcode in lapbeth_open() · 3faf7e14
      Zhengchao Shao authored
      If lapb_register() failed when lapb device goes to up for the first time,
      the NAPI is not disabled. As a result, the invalid opcode issue is
      reported when the lapb device goes to up for the second time.
      
      The stack info is as follows:
      [ 1958.311422][T11356] kernel BUG at net/core/dev.c:6442!
      [ 1958.312206][T11356] invalid opcode: 0000 [#1] PREEMPT SMP KASAN
      [ 1958.315979][T11356] RIP: 0010:napi_enable+0x16a/0x1f0
      [ 1958.332310][T11356] Call Trace:
      [ 1958.332817][T11356]  <TASK>
      [ 1958.336135][T11356]  lapbeth_open+0x18/0x90
      [ 1958.337446][T11356]  __dev_open+0x258/0x490
      [ 1958.341672][T11356]  __dev_change_flags+0x4d4/0x6a0
      [ 1958.345325][T11356]  dev_change_flags+0x93/0x160
      [ 1958.346027][T11356]  devinet_ioctl+0x1276/0x1bf0
      [ 1958.346738][T11356]  inet_ioctl+0x1c8/0x2d0
      [ 1958.349638][T11356]  sock_ioctl+0x5d1/0x750
      [ 1958.356059][T11356]  __x64_sys_ioctl+0x3ec/0x1790
      [ 1958.365594][T11356]  do_syscall_64+0x35/0x80
      [ 1958.366239][T11356]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
      [ 1958.377381][T11356]  </TASK>
      
      Fixes: 514e1150
      
       ("net: x25: Queue received packets in the drivers instead of per-CPU queues")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Link: https://lore.kernel.org/r/20221107011445.207372-1-shaozhengchao@huawei.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      3faf7e14
    • Jakub Kicinski's avatar
      Merge branch 'sctp-fix-a-null-pointer-dereference-in-sctp_sched_dequeue_common' · 89bbe785
      Jakub Kicinski authored
      
      
      Xin Long says:
      
      ====================
      sctp: fix a NULL pointer dereference in sctp_sched_dequeue_common
      
      This issue was triggered with SCTP_PR_SCTP_PRIO in sctp,
      and caused by not checking and fixing stream->out_curr
      after removing a chunk from this stream.
      
      Patch 1 removes an unnecessary check and makes the real
      fix easier to add in Patch 2.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1667598261.git.lucien.xin@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      89bbe785
    • Xin Long's avatar
      sctp: clear out_curr if all frag chunks of current msg are pruned · 2f201ae1
      Xin Long authored
      A crash was reported by Zhen Chen:
      
        list_del corruption, ffffa035ddf01c18->next is NULL
        WARNING: CPU: 1 PID: 250682 at lib/list_debug.c:49 __list_del_entry_valid+0x59/0xe0
        RIP: 0010:__list_del_entry_valid+0x59/0xe0
        Call Trace:
         sctp_sched_dequeue_common+0x17/0x70 [sctp]
         sctp_sched_fcfs_dequeue+0x37/0x50 [sctp]
         sctp_outq_flush_data+0x85/0x360 [sctp]
         sctp_outq_uncork+0x77/0xa0 [sctp]
         sctp_cmd_interpreter.constprop.0+0x164/0x1450 [sctp]
         sctp_side_effects+0x37/0xe0 [sctp]
         sctp_do_sm+0xd0/0x230 [sctp]
         sctp_primitive_SEND+0x2f/0x40 [sctp]
         sctp_sendmsg_to_asoc+0x3fa/0x5c0 [sctp]
         sctp_sendmsg+0x3d5/0x440 [sctp]
         sock_sendmsg+0x5b/0x70
      
      and in sctp_sched_fcfs_dequeue() it dequeued a chunk from stream
      out_curr outq while this outq was empty.
      
      Normally stream->out_curr must be set to NULL once all frag chunks of
      current msg are dequeued, as we can see in sctp_sched_dequeue_done().
      However, in sctp_prsctp_prune_unsent() as it is not a proper dequeue,
      sctp_sched_dequeue_done() is not called to do this.
      
      This patch is to fix it by simply setting out_curr to NULL when the
      last frag chunk of current msg is dequeued from out_curr stream in
      sctp_prsctp_prune_unsent().
      
      Fixes: 5bbbbe32
      
       ("sctp: introduce stream scheduler foundations")
      Reported-by: default avatarZhen Chen <chenzhen126@huawei.com>
      Tested-by: default avatarCaowangbao <caowangbao@huawei.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2f201ae1
    • Xin Long's avatar
      sctp: remove the unnecessary sinfo_stream check in sctp_prsctp_prune_unsent · 9f0b7732
      Xin Long authored
      Since commit 5bbbbe32
      
       ("sctp: introduce stream scheduler foundations"),
      sctp_stream_outq_migrate() has been called in sctp_stream_init/update to
      removes those chunks to streams higher than the new max. There is no longer
      need to do such check in sctp_prsctp_prune_unsent().
      
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9f0b7732
    • Xin Long's avatar
      tipc: fix the msg->req tlv len check in tipc_nl_compat_name_table_dump_header · 1c075b19
      Xin Long authored
      This is a follow-up for commit 974cb0e3
      
       ("tipc: fix uninit-value
      in tipc_nl_compat_name_table_dump") where it should have type casted
      sizeof(..) to int to work when TLV_GET_DATA_LEN() returns a negative
      value.
      
      syzbot reported a call trace because of it:
      
        BUG: KMSAN: uninit-value in ...
         tipc_nl_compat_name_table_dump+0x841/0xea0 net/tipc/netlink_compat.c:934
         __tipc_nl_compat_dumpit+0xab2/0x1320 net/tipc/netlink_compat.c:238
         tipc_nl_compat_dumpit+0x991/0xb50 net/tipc/netlink_compat.c:321
         tipc_nl_compat_recv+0xb6e/0x1640 net/tipc/netlink_compat.c:1324
         genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
         genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
         genl_rcv_msg+0x103f/0x1260 net/netlink/genetlink.c:792
         netlink_rcv_skb+0x3a5/0x6c0 net/netlink/af_netlink.c:2501
         genl_rcv+0x3c/0x50 net/netlink/genetlink.c:803
         netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
         netlink_unicast+0xf3b/0x1270 net/netlink/af_netlink.c:1345
         netlink_sendmsg+0x1288/0x1440 net/netlink/af_netlink.c:1921
         sock_sendmsg_nosec net/socket.c:714 [inline]
         sock_sendmsg net/socket.c:734 [inline]
      
      Reported-by: default avatar <syzbot+e5dbaaa238680ce206ea@syzkaller.appspotmail.com>
      Fixes: 974cb0e3
      
       ("tipc: fix uninit-value in tipc_nl_compat_name_table_dump")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://lore.kernel.org/r/ccd6a7ea801b15aec092c3b532a883b4c5708695.1667594933.git.lucien.xin@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1c075b19
    • YueHaibing's avatar
      net: broadcom: Fix BCMGENET Kconfig · 8d820bc9
      YueHaibing authored
      While BCMGENET select BROADCOM_PHY as y, but PTP_1588_CLOCK_OPTIONAL is m,
      kconfig warning and build errors:
      
      WARNING: unmet direct dependencies detected for BROADCOM_PHY
        Depends on [m]: NETDEVICES [=y] && PHYLIB [=y] && PTP_1588_CLOCK_OPTIONAL [=m]
        Selected by [y]:
        - BCMGENET [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_BROADCOM [=y] && HAS_IOMEM [=y] && ARCH_BCM2835 [=y]
      
      drivers/net/phy/broadcom.o: In function `bcm54xx_suspend':
      broadcom.c:(.text+0x6ac): undefined reference to `bcm_ptp_stop'
      drivers/net/phy/broadcom.o: In function `bcm54xx_phy_probe':
      broadcom.c:(.text+0x784): undefined reference to `bcm_ptp_probe'
      drivers/net/phy/broadcom.o: In function `bcm54xx_config_init':
      broadcom.c:(.text+0xd4c): undefined reference to `bcm_ptp_config_init'
      
      Fixes: 99addbe3
      
       ("net: broadcom: Select BROADCOM_PHY for BCMGENET")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@broadcom.com>
      Link: https://lore.kernel.org/r/20221105090245.8508-1-yuehaibing@huawei.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8d820bc9
    • Yang Yingliang's avatar
      octeontx2-pf: fix build error when CONFIG_OCTEONTX2_PF=y · 02f5999e
      Yang Yingliang authored
      If CONFIG_MACSEC=m and CONFIG_OCTEONTX2_PF=y, it leads a build error:
      
        ld: drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.o: in function `otx2_pfaf_mbox_up_handler':
        otx2_pf.c:(.text+0x181c): undefined reference to `cn10k_handle_mcs_event'
        ld: drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.o: in function `otx2_probe':
        otx2_pf.c:(.text+0x437e): undefined reference to `cn10k_mcs_init'
        ld: drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.o: in function `otx2_remove':
        otx2_pf.c:(.text+0x5031): undefined reference to `cn10k_mcs_free'
        ld: drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.o: in function `otx2_mbox_up_handler_mcs_intr_notify':
        otx2_pf.c:(.text+0x5f11): undefined reference to `cn10k_handle_mcs_event'
      
      Make CONFIG_OCTEONTX2_PF depends on CONFIG_MACSEC to fix it. Because
      it has empty stub functions of cn10k, CONFIG_OCTEONTX2_PF can be enabled
      if CONFIG_MACSEC is disabled
      
      Fixes: c54ffc73
      
       ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Link: https://lore.kernel.org/r/20221105063442.2013981-1-yangyingliang@huawei.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      02f5999e
    • Miquel Raynal's avatar
      dt-bindings: net: tsnep: Fix typo on generic nvmem property · ec683f02
      Miquel Raynal authored
      While working on the nvmem description I figured out this file had the
      "nvmem-cell-names" property name misspelled. Fix the typo, as
      "nvmem-cells-names" has never existed.
      
      Fixes: 603094b2
      
       ("dt-bindings: net: Add tsnep Ethernet controller")
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Reviewed-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Link: https://lore.kernel.org/r/20221104162147.1288230-1-miquel.raynal@bootlin.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec683f02
    • Rasmus Villemoes's avatar
      net: stmmac: dwmac-meson8b: fix meson8b_devm_clk_prepare_enable() · ed4314f7
      Rasmus Villemoes authored
      There are two problems with meson8b_devm_clk_prepare_enable(),
      introduced in commit a54dc4a4 ("net: stmmac: dwmac-meson8b:
      Make the clock enabling code re-usable"):
      
      - It doesn't pass the clk argument, but instead always the
        rgmii_tx_clk of the device.
      
      - It silently ignores the return value of devm_add_action_or_reset().
      
      The former didn't become an actual bug until another user showed up in
      the next commit 9308c476 ("net: stmmac: dwmac-meson8b: add support
      for the RX delay configuration"). The latter means the callers could
      end up with the clock not actually prepared/enabled.
      
      Fixes: a54dc4a4
      
       ("net: stmmac: dwmac-meson8b: Make the clock enabling code re-usable")
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Link: https://lore.kernel.org/r/20221104083004.2212520-1-linux@rasmusvillemoes.dk
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ed4314f7
  3. Nov 07, 2022
    • Geert Uytterhoeven's avatar
      can: rcar_canfd: Add missing ECC error checks for channels 2-7 · 8b043dfb
      Geert Uytterhoeven authored
      When introducing support for R-Car V3U, which has 8 instead of 2
      channels, the ECC error bitmask was extended to take into account the
      extra channels, but rcar_canfd_global_error() was not updated to act
      upon the extra bits.
      
      Replace the RCANFD_GERFL_EEF[01] macros by a new macro that takes the
      channel number, fixing R-Car V3U while simplifying the code.
      
      Fixes: 45721c40
      
       ("can: rcar_canfd: Add support for r8a779a0 SoC")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
      Link: https://lore.kernel.org/all/4edb2ea46cc64d0532a08a924179827481e14b4f.1666951503.git.geert+renesas@glider.be
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      8b043dfb
    • Oliver Hartkopp's avatar
      can: dev: fix skb drop check · ae64438b
      Oliver Hartkopp authored
      In commit a6d190f8 ("can: skb: drop tx skb if in listen only
      mode") the priv->ctrlmode element is read even on virtual CAN
      interfaces that do not create the struct can_priv at startup. This
      out-of-bounds read may lead to CAN frame drops for virtual CAN
      interfaces like vcan and vxcan.
      
      This patch mainly reverts the original commit and adds a new helper
      for CAN interface drivers that provide the required information in
      struct can_priv.
      
      Fixes: a6d190f8
      
       ("can: skb: drop tx skb if in listen only mode")
      Reported-by: default avatarDariusz Stojaczyk <Dariusz.Stojaczyk@opensynergy.com>
      Cc: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
      Cc: Max Staudt <max@enpas.org>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Acked-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Link: https://lore.kernel.org/all/20221102095431.36831-1-socketcan@hartkopp.net
      Cc: stable@vger.kernel.org # 6.0.x
      [mkl: patch pch_can, too]
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      ae64438b
    • Oliver Hartkopp's avatar
      can: j1939: j1939_send_one(): fix missing CAN header initialization · 3eb3d283
      Oliver Hartkopp authored
      The read access to struct canxl_frame::len inside of a j1939 created
      skbuff revealed a missing initialization of reserved and later filled
      elements in struct can_frame.
      
      This patch initializes the 8 byte CAN header with zero.
      
      Fixes: 9d71dd0c
      
       ("can: add support of SAE J1939 protocol")
      Cc: Oleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/linux-can/20221104052235.GA6474@pengutronix.de
      Reported-by: default avatar <syzbot+d168ec0caca4697e03b1@syzkaller.appspotmail.com>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/all/20221104075000.105414-1-socketcan@hartkopp.net
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      3eb3d283
    • Oliver Hartkopp's avatar
      can: isotp: fix tx state handling for echo tx processing · 86633786
      Oliver Hartkopp authored
      In commit 4b7fe92c ("can: isotp: add local echo tx processing for
      consecutive frames") the data flow for consecutive frames (CF) has been
      reworked to improve the reliability of long data transfers.
      
      This rework did not touch the transmission and the tx state changes of
      single frame (SF) transfers which likely led to the WARN in the
      isotp_tx_timer_handler() catching a wrong tx state. This patch makes use
      of the improved frame processing for SF frames and sets the ISOTP_SENDING
      state in isotp_sendmsg() within the cmpxchg() condition handling.
      
      A review of the state machine and the timer handling additionally revealed
      a missing echo timeout handling in the case of the burst mode in
      isotp_rcv_echo() and removes a potential timer configuration uncertainty
      in isotp_rcv_fc() when the receiver requests consecutive frames.
      
      Fixes: 4b7fe92c
      
       ("can: isotp: add local echo tx processing for consecutive frames")
      Link: https://lore.kernel.org/linux-can/CAO4mrfe3dG7cMP1V5FLUkw7s+50c9vichigUMQwsxX4M=45QEw@mail.gmail.com/T/#u
      Reported-by: default avatarWei Chen <harperchen1110@gmail.com>
      Cc: stable@vger.kernel.org # v6.0
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/all/20221104142551.16924-1-socketcan@hartkopp.net
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      86633786
    • Zhengchao Shao's avatar
      can: af_can: fix NULL pointer dereference in can_rx_register() · 8aa59e35
      Zhengchao Shao authored
      It causes NULL pointer dereference when testing as following:
      (a) use syscall(__NR_socket, 0x10ul, 3ul, 0) to create netlink socket.
      (b) use syscall(__NR_sendmsg, ...) to create bond link device and vxcan
          link device, and bind vxcan device to bond device (can also use
          ifenslave command to bind vxcan device to bond device).
      (c) use syscall(__NR_socket, 0x1dul, 3ul, 1) to create CAN socket.
      (d) use syscall(__NR_bind, ...) to bind the bond device to CAN socket.
      
      The bond device invokes the can-raw protocol registration interface to
      receive CAN packets. However, ml_priv is not allocated to the dev,
      dev_rcv_lists is assigned to NULL in can_rx_register(). In this case,
      it will occur the NULL pointer dereference issue.
      
      The following is the stack information:
      BUG: kernel NULL pointer dereference, address: 0000000000000008
      PGD 122a4067 P4D 122a4067 PUD 1223c067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      RIP: 0010:can_rx_register+0x12d/0x1e0
      Call Trace:
      <TASK>
      raw_enable_filters+0x8d/0x120
      raw_enable_allfilters+0x3b/0x130
      raw_bind+0x118/0x4f0
      __sys_bind+0x163/0x1a0
      __x64_sys_bind+0x1e/0x30
      do_syscall_64+0x35/0x80
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
      </TASK>
      
      Fixes: 4e096a18
      
       ("net: introduce CAN specific pointer in the struct net_device")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Link: https://lore.kernel.org/all/20221028085650.170470-1-shaozhengchao@huawei.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      8aa59e35
    • Chen Zhongjin's avatar
      can: af_can: can_exit(): add missing dev_remove_pack() of canxl_packet · a3335fae
      Chen Zhongjin authored
      In can_init(), dev_add_pack(&canxl_packet) is added but not removed in
      can_exit(). It breaks the packet handler list and can make kernel
      panic when can_init() is called for the second time.
      
      | > modprobe can && rmmod can
      | > rmmod xxx && modprobe can
      |
      | BUG: unable to handle page fault for address: fffffbfff807d7f4
      | RIP: 0010:dev_add_pack+0x133/0x1f0
      | Call Trace:
      |  <TASK>
      |  can_init+0xaa/0x1000 [can]
      |  do_one_initcall+0xd3/0x4e0
      |  ...
      
      Fixes: fb08cba1
      
       ("can: canxl: update CAN infrastructure for CAN XL frames")
      Signed-off-by: default avatarChen Zhongjin <chenzhongjin@huawei.com>
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/all/20221031033053.37849-1-chenzhongjin@huawei.com
      [mkl: adjust subject and commit message]
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      a3335fae
    • Alexander Potapenko's avatar
      ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to network · c23fb2c8
      Alexander Potapenko authored
      
      
      When copying a `struct ifaddrlblmsg` to the network, __ifal_reserved
      remained uninitialized, resulting in a 1-byte infoleak:
      
        BUG: KMSAN: kernel-network-infoleak in __netdev_start_xmit ./include/linux/netdevice.h:4841
         __netdev_start_xmit ./include/linux/netdevice.h:4841
         netdev_start_xmit ./include/linux/netdevice.h:4857
         xmit_one net/core/dev.c:3590
         dev_hard_start_xmit+0x1dc/0x800 net/core/dev.c:3606
         __dev_queue_xmit+0x17e8/0x4350 net/core/dev.c:4256
         dev_queue_xmit ./include/linux/netdevice.h:3009
         __netlink_deliver_tap_skb net/netlink/af_netlink.c:307
         __netlink_deliver_tap+0x728/0xad0 net/netlink/af_netlink.c:325
         netlink_deliver_tap net/netlink/af_netlink.c:338
         __netlink_sendskb net/netlink/af_netlink.c:1263
         netlink_sendskb+0x1d9/0x200 net/netlink/af_netlink.c:1272
         netlink_unicast+0x56d/0xf50 net/netlink/af_netlink.c:1360
         nlmsg_unicast ./include/net/netlink.h:1061
         rtnl_unicast+0x5a/0x80 net/core/rtnetlink.c:758
         ip6addrlbl_get+0xfad/0x10f0 net/ipv6/addrlabel.c:628
         rtnetlink_rcv_msg+0xb33/0x1570 net/core/rtnetlink.c:6082
        ...
        Uninit was created at:
         slab_post_alloc_hook+0x118/0xb00 mm/slab.h:742
         slab_alloc_node mm/slub.c:3398
         __kmem_cache_alloc_node+0x4f2/0x930 mm/slub.c:3437
         __do_kmalloc_node mm/slab_common.c:954
         __kmalloc_node_track_caller+0x117/0x3d0 mm/slab_common.c:975
         kmalloc_reserve net/core/skbuff.c:437
         __alloc_skb+0x27a/0xab0 net/core/skbuff.c:509
         alloc_skb ./include/linux/skbuff.h:1267
         nlmsg_new ./include/net/netlink.h:964
         ip6addrlbl_get+0x490/0x10f0 net/ipv6/addrlabel.c:608
         rtnetlink_rcv_msg+0xb33/0x1570 net/core/rtnetlink.c:6082
         netlink_rcv_skb+0x299/0x550 net/netlink/af_netlink.c:2540
         rtnetlink_rcv+0x26/0x30 net/core/rtnetlink.c:6109
         netlink_unicast_kernel net/netlink/af_netlink.c:1319
         netlink_unicast+0x9ab/0xf50 net/netlink/af_netlink.c:1345
         netlink_sendmsg+0xebc/0x10f0 net/netlink/af_netlink.c:1921
        ...
      
      This patch ensures that the reserved field is always initialized.
      
      Reported-by: default avatar <syzbot+3553517af6020c4f2813f1003fe76ef3cbffe98d@syzkaller.appspotmail.com>
      Fixes: 2a8cc6c8
      
       ("[IPV6] ADDRCONF: Support RFC3484 configurable address selection policy table.")
      Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c23fb2c8
    • Lu Wei's avatar
      tcp: prohibit TCP_REPAIR_OPTIONS if data was already sent · 0c175da7
      Lu Wei authored
      If setsockopt with option name of TCP_REPAIR_OPTIONS and opt_code
      of TCPOPT_SACK_PERM is called to enable sack after data is sent
      and dupacks are received , it will trigger a warning in function
      tcp_verify_left_out() as follows:
      
      ============================================
      WARNING: CPU: 8 PID: 0 at net/ipv4/tcp_input.c:2132
      tcp_timeout_mark_lost+0x154/0x160
      tcp_enter_loss+0x2b/0x290
      tcp_retransmit_timer+0x50b/0x640
      tcp_write_timer_handler+0x1c8/0x340
      tcp_write_timer+0xe5/0x140
      call_timer_fn+0x3a/0x1b0
      __run_timers.part.0+0x1bf/0x2d0
      run_timer_softirq+0x43/0xb0
      __do_softirq+0xfd/0x373
      __irq_exit_rcu+0xf6/0x140
      
      The warning is caused in the following steps:
      1. a socket named socketA is created
      2. socketA enters repair mode without build a connection
      3. socketA calls connect() and its state is changed to TCP_ESTABLISHED
         directly
      4. socketA leaves repair mode
      5. socketA calls sendmsg() to send data, packets_out and sack_outs(dup
         ack receives) increase
      6. socketA enters repair mode again
      7. socketA calls setsockopt with TCPOPT_SACK_PERM to enable sack
      8. retransmit timer expires, it calls tcp_timeout_mark_lost(), lost_out
         increases
      9. sack_outs + lost_out > packets_out triggers since lost_out and
         sack_outs increase repeatly
      
      In function tcp_timeout_mark_lost(), tp->sacked_out will be cleared if
      Step7 not happen and the warning will not be triggered. As suggested by
      Denis and Eric, TCP_REPAIR_OPTIONS should be prohibited if data was
      already sent.
      
      socket-tcp tests in CRIU has been tested as follows:
      $ sudo ./test/zdtm.py run -t zdtm/static/socket-tcp*  --keep-going \
             --ignore-taint
      
      socket-tcp* represent all socket-tcp tests in test/zdtm/static/.
      
      Fixes: b139ba4e
      
       ("tcp: Repair connection-time negotiated parameters")
      Signed-off-by: default avatarLu Wei <luwei32@huawei.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0c175da7
    • Zhaoping Shu's avatar
      net: wwan: iosm: Remove unnecessary if_mutex lock · f9027f88
      Zhaoping Shu authored
      
      
      These WWAN network interface operations (create/delete/open/close)
      are already protected by RTNL lock, i.e., wwan_ops.newlink(),
      wwan_ops.dellink(), net_device_ops.ndo_open() and
      net_device.ndo_stop() are called with RTNL lock held.
      Therefore, this patch removes the unnecessary if_mutex.
      
      Signed-off-by: default avatarZhaoping Shu <zhaoping.shu@mediatek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f9027f88
    • HW He's avatar
      net: wwan: mhi: fix memory leak in mhi_mbim_dellink · 668205b9
      HW He authored
      MHI driver registers network device without setting the
      needs_free_netdev flag, and does NOT call free_netdev() when
      unregisters network device, which causes a memory leak.
      
      This patch sets needs_free_netdev to true when registers
      network device, which makes netdev subsystem call free_netdev()
      automatically after unregister_netdevice().
      
      Fixes: aa730a99
      
       ("net: wwan: Add MHI MBIM network driver")
      Signed-off-by: default avatarHW He <hw.he@mediatek.com>
      Signed-off-by: default avatarZhaoping Shu <zhaoping.shu@mediatek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      668205b9
    • HW He's avatar
      net: wwan: iosm: fix memory leak in ipc_wwan_dellink · f25caaca
      HW He authored
      IOSM driver registers network device without setting the
      needs_free_netdev flag, and does NOT call free_netdev() when
      unregisters network device, which causes a memory leak.
      
      This patch sets needs_free_netdev to true when registers
      network device, which makes netdev subsystem call free_netdev()
      automatically after unregister_netdevice().
      
      Fixes: 2a54f2c7
      
       ("net: iosm: net driver")
      Signed-off-by: default avatarHW He <hw.he@mediatek.com>
      Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarZhaoping Shu <zhaoping.shu@mediatek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f25caaca
    • Zhengchao Shao's avatar
      hamradio: fix issue of dev reference count leakage in bpq_device_event() · 85cbaf03
      Zhengchao Shao authored
      When following tests are performed, it will cause dev reference counting
      leakage.
      a)ip link add bond2 type bond mode balance-rr
      b)ip link set bond2 up
      c)ifenslave -f bond2 rose1
      d)ip link del bond2
      
      When new bond device is created, the default type of the bond device is
      ether. And the bond device is up, bpq_device_event() receives the message
      and creates a new bpq device. In this case, the reference count value of
      dev is hold once. But after "ifenslave -f bond2 rose1" command is
      executed, the type of the bond device is changed to rose. When the bond
      device is unregistered, bpq_device_event() will not put the dev reference
      count.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85cbaf03
    • Zhengchao Shao's avatar
      net: lapbether: fix issue of dev reference count leakage in lapbeth_device_event() · 531705a7
      Zhengchao Shao authored
      When following tests are performed, it will cause dev reference counting
      leakage.
      a)ip link add bond2 type bond mode balance-rr
      b)ip link set bond2 up
      c)ifenslave -f bond2 rose1
      d)ip link del bond2
      
      When new bond device is created, the default type of the bond device is
      ether. And the bond device is up, lapbeth_device_event() receives the
      message and creates a new lapbeth device. In this case, the reference
      count value of dev is hold once. But after "ifenslave -f bond2 rose1"
      command is executed, the type of the bond device is changed to rose. When
      the bond device is unregistered, lapbeth_device_event() will not put the
      dev reference count.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      531705a7
  4. Nov 05, 2022
    • Sean Anderson's avatar
      net: fman: Unregister ethernet device on removal · b7cbc674
      Sean Anderson authored
      When the mac device gets removed, it leaves behind the ethernet device.
      This will result in a segfault next time the ethernet device accesses
      mac_dev. Remove the ethernet device when we get removed to prevent
      this. This is not completely reversible, since some resources aren't
      cleaned up properly, but that can be addressed later.
      
      Fixes: 39339616
      
       ("fsl/fman: Add FMan MAC driver")
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Link: https://lore.kernel.org/r/20221103182831.2248833-1-sean.anderson@seco.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b7cbc674
    • Jakub Kicinski's avatar
      Merge branch 'bnxt_en-bug-fixes' · c3812c95
      Jakub Kicinski authored
      
      
      Michael Chan says:
      
      ====================
      bnxt_en: Bug fixes
      
      This bug fix series includes fixes for PCIE AER, a crash that may occur
      when doing ethtool -C in the middle of error recovery, and aRFS.
      ====================
      
      Link: https://lore.kernel.org/r/1667518407-15761-1-git-send-email-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c3812c95
    • Alex Barba's avatar
      bnxt_en: fix potentially incorrect return value for ndo_rx_flow_steer · 02597d39
      Alex Barba authored
      In the bnxt_en driver ndo_rx_flow_steer returns '0' whenever an entry
      that we are attempting to steer is already found.  This is not the
      correct behavior.  The return code should be the value/index that
      corresponds to the entry.  Returning zero all the time causes the
      RFS records to be incorrect unless entry '0' is the correct one.  As
      flows migrate to different cores this can create entries that are not
      correct.
      
      Fixes: c0c050c5
      
       ("bnxt_en: New Broadcom ethernet driver.")
      Reported-by: default avatarAkshay Navgire <anavgire@purestorage.com>
      Signed-off-by: default avatarAlex Barba <alex.barba@broadcom.com>
      Signed-off-by: default avatarAndy Gospodarek <gospo@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      02597d39
    • Michael Chan's avatar
      bnxt_en: Fix possible crash in bnxt_hwrm_set_coal() · 6d81ea37
      Michael Chan authored
      During the error recovery sequence, the rtnl_lock is not held for the
      entire duration and some datastructures may be freed during the sequence.
      Check for the BNXT_STATE_OPEN flag instead of netif_running() to ensure
      that the device is fully operational before proceeding to reconfigure
      the coalescing settings.
      
      This will fix a possible crash like this:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
      PGD 0 P4D 0
      Oops: 0000 [#1] SMP NOPTI
      CPU: 10 PID: 181276 Comm: ethtool Kdump: loaded Tainted: G          IOE    --------- -  - 4.18.0-348.el8.x86_64 #1
      Hardware name: Dell Inc. PowerEdge R740/0F9N89, BIOS 2.3.10 08/15/2019
      RIP: 0010:bnxt_hwrm_set_coal+0x1fb/0x2a0 [bnxt_en]
      Code: c2 66 83 4e 22 08 66 89 46 1c e8 10 cb 00 00 41 83 c6 01 44 39 b3 68 01 00 00 0f 8e a3 00 00 00 48 8b 93 c8 00 00 00 49 63 c6 <48> 8b 2c c2 48 8b 85 b8 02 00 00 48 85 c0 74 2e 48 8b 74 24 08 f6
      RSP: 0018:ffffb11c8dcaba50 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffff8d168a8b0ac0 RCX: 00000000000000c5
      RDX: 0000000000000000 RSI: ffff8d162f72c000 RDI: ffff8d168a8b0b28
      RBP: 0000000000000000 R08: b6e1f68a12e9a7eb R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000037 R12: ffff8d168a8b109c
      R13: ffff8d168a8b10aa R14: 0000000000000000 R15: ffffffffc01ac4e0
      FS:  00007f3852e4c740(0000) GS:ffff8d24c0080000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000000 CR3: 000000041b3ee003 CR4: 00000000007706e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
       ethnl_set_coalesce+0x3ce/0x4c0
       genl_family_rcv_msg_doit.isra.15+0x10f/0x150
       genl_family_rcv_msg+0xb3/0x160
       ? coalesce_fill_reply+0x480/0x480
       genl_rcv_msg+0x47/0x90
       ? genl_family_rcv_msg+0x160/0x160
       netlink_rcv_skb+0x4c/0x120
       genl_rcv+0x24/0x40
       netlink_unicast+0x196/0x230
       netlink_sendmsg+0x204/0x3d0
       sock_sendmsg+0x4c/0x50
       __sys_sendto+0xee/0x160
       ? syscall_trace_enter+0x1d3/0x2c0
       ? __audit_syscall_exit+0x249/0x2a0
       __x64_sys_sendto+0x24/0x30
       do_syscall_64+0x5b/0x1a0
       entry_SYSCALL_64_after_hwframe+0x65/0xca
      RIP: 0033:0x7f38524163bb
      
      Fixes: 2151fe08
      
       ("bnxt_en: Handle RESET_NOTIFY async event from firmware.")
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6d81ea37
    • Vikas Gupta's avatar
      bnxt_en: fix the handling of PCIE-AER · 0cf736a1
      Vikas Gupta authored
      Fix the sequence required for PCIE-AER. While slot reset occurs, firmware
      might not be ready and the driver needs to check for its recovery.  We
      also need to remap the health registers for some chips and clear the
      resource reservations.  The resources will be allocated again during
      bnxt_io_resume().
      
      Fixes: fb1e6e56
      
       ("bnxt_en: Fix AER recovery.")
      Signed-off-by: default avatarVikas Gupta <vikas.gupta@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0cf736a1
    • Vikas Gupta's avatar
      bnxt_en: refactor bnxt_cancel_reservations() · b4c66425
      Vikas Gupta authored
      
      
      Introduce bnxt_clear_reservations() to clear the reserved attributes only.
      This will be used in the next patch to fix PCI AER handling.
      
      Signed-off-by: default avatarVikas Gupta <vikas.gupta@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b4c66425
  5. Nov 04, 2022
    • Wang Yufen's avatar
      net: tun: Fix memory leaks of napi_get_frags · 1118b204
      Wang Yufen authored
      kmemleak reports after running test_progs:
      
      unreferenced object 0xffff8881b1672dc0 (size 232):
        comm "test_progs", pid 394388, jiffies 4354712116 (age 841.975s)
        hex dump (first 32 bytes):
          e0 84 d7 a8 81 88 ff ff 80 2c 67 b1 81 88 ff ff  .........,g.....
          00 40 c5 9b 81 88 ff ff 00 00 00 00 00 00 00 00  .@..............
        backtrace:
          [<00000000c8f01748>] napi_skb_cache_get+0xd4/0x150
          [<0000000041c7fc09>] __napi_build_skb+0x15/0x50
          [<00000000431c7079>] __napi_alloc_skb+0x26e/0x540
          [<000000003ecfa30e>] napi_get_frags+0x59/0x140
          [<0000000099b2199e>] tun_get_user+0x183d/0x3bb0 [tun]
          [<000000008a5adef0>] tun_chr_write_iter+0xc0/0x1b1 [tun]
          [<0000000049993ff4>] do_iter_readv_writev+0x19f/0x320
          [<000000008f338ea2>] do_iter_write+0x135/0x630
          [<000000008a3377a4>] vfs_writev+0x12e/0x440
          [<00000000a6b5639a>] do_writev+0x104/0x280
          [<00000000ccf065d8>] do_syscall_64+0x3b/0x90
          [<00000000d776e329>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The issue occurs in the following scenarios:
      tun_get_user()
        napi_gro_frags()
          napi_frags_finish()
            case GRO_NORMAL:
              gro_normal_one()
                list_add_tail(&skb->list, &napi->rx_list);
                <-- While napi->rx_count < READ_ONCE(gro_normal_batch),
                <-- gro_normal_list() is not called, napi->rx_list is not empty
        <-- not ask to complete the gro work, will cause memory leaks in
        <-- following tun_napi_del()
      ...
      tun_napi_del()
        netif_napi_del()
          __netif_napi_del()
          <-- &napi->rx_list is not empty, which caused memory leaks
      
      To fix, add napi_complete() after napi_gro_frags().
      
      Fixes: 90e33d45
      
       ("tun: enable napi_gro_frags() for TUN/TAP driver")
      Signed-off-by: default avatarWang Yufen <wangyufen@huawei.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1118b204
    • Ratheesh Kannoth's avatar
      octeontx2-pf: NIX TX overwrites SQ_CTX_HW_S[SQ_INT] · 51afe902
      Ratheesh Kannoth authored
      In scenarios where multiple errors have occurred
      for a SQ before SW starts handling error interrupt,
      SQ_CTX[OP_INT] may get overwritten leading to
      NIX_LF_SQ_OP_INT returning incorrect value.
      To workaround this read LMT, MNQ and SQ individual
      error status registers to determine the cause of error.
      
      Fixes: 4ff7d148
      
       ("octeontx2-pf: Error handling support")
      Signed-off-by: default avatarRatheesh Kannoth <rkannoth@marvell.com>
      Reviewed-by: default avatarSunil Kovvuri Goutham <sgoutham@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      51afe902
    • Roger Quadros's avatar
      net: ethernet: ti: am65-cpsw: Fix segmentation fault at module unload · 1a0c016a
      Roger Quadros authored
      Move am65_cpsw_nuss_phylink_cleanup() call to after
      am65_cpsw_nuss_cleanup_ndev() so phylink is still valid
      to prevent the below Segmentation fault on module remove when
      first slave link is up.
      
      [   31.652944] Unable to handle kernel paging request at virtual address 00040008000005f4
      [   31.684627] Mem abort info:
      [   31.687446]   ESR = 0x0000000096000004
      [   31.704614]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   31.720663]   SET = 0, FnV = 0
      [   31.723729]   EA = 0, S1PTW = 0
      [   31.740617]   FSC = 0x04: level 0 translation fault
      [   31.756624] Data abort info:
      [   31.759508]   ISV = 0, ISS = 0x00000004
      [   31.776705]   CM = 0, WnR = 0
      [   31.779695] [00040008000005f4] address between user and kernel address ranges
      [   31.808644] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
      [   31.814928] Modules linked in: wlcore_sdio wl18xx wlcore mac80211 libarc4 cfg80211 rfkill crct10dif_ce phy_gmii_sel ti_am65_cpsw_nuss(-) sch_fq_codel ipv6
      [   31.828776] CPU: 0 PID: 1026 Comm: modprobe Not tainted 6.1.0-rc2-00012-gfabfcf7dafdb-dirty #160
      [   31.837547] Hardware name: Texas Instruments AM625 (DT)
      [   31.842760] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [   31.849709] pc : phy_stop+0x18/0xf8
      [   31.853202] lr : phylink_stop+0x38/0xf8
      [   31.857031] sp : ffff80000a0839f0
      [   31.860335] x29: ffff80000a0839f0 x28: ffff000000de1c80 x27: 0000000000000000
      [   31.867462] x26: 0000000000000000 x25: 0000000000000000 x24: ffff80000a083b98
      [   31.874589] x23: 0000000000000800 x22: 0000000000000001 x21: ffff000001bfba90
      [   31.881715] x20: ffff0000015ee000 x19: 0004000800000200 x18: 0000000000000000
      [   31.888842] x17: ffff800076c45000 x16: ffff800008004000 x15: 000058e39660b106
      [   31.895969] x14: 0000000000000144 x13: 0000000000000144 x12: 0000000000000000
      [   31.903095] x11: 000000000000275f x10: 00000000000009e0 x9 : ffff80000a0837d0
      [   31.910222] x8 : ffff000000de26c0 x7 : ffff00007fbd6540 x6 : ffff00007fbd64c0
      [   31.917349] x5 : ffff00007fbd0b10 x4 : ffff00007fbd0b10 x3 : ffff00007fbd3920
      [   31.924476] x2 : d0a07fcff8b8d500 x1 : 0000000000000000 x0 : 0004000800000200
      [   31.931603] Call trace:
      [   31.934042]  phy_stop+0x18/0xf8
      [   31.937177]  phylink_stop+0x38/0xf8
      [   31.940657]  am65_cpsw_nuss_ndo_slave_stop+0x28/0x1e0 [ti_am65_cpsw_nuss]
      [   31.947452]  __dev_close_many+0xa4/0x140
      [   31.951371]  dev_close_many+0x84/0x128
      [   31.955115]  unregister_netdevice_many+0x130/0x6d0
      [   31.959897]  unregister_netdevice_queue+0x94/0xd8
      [   31.964591]  unregister_netdev+0x24/0x38
      [   31.968504]  am65_cpsw_nuss_cleanup_ndev.isra.0+0x48/0x70 [ti_am65_cpsw_nuss]
      [   31.975637]  am65_cpsw_nuss_remove+0x58/0xf8 [ti_am65_cpsw_nuss]
      
      Cc: <Stable@vger.kernel.org> # v5.18+
      Fixes: e8609e69
      
       ("net: ethernet: ti: am65-cpsw: Convert to PHYLINK")
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a0c016a
    • David S. Miller's avatar
      Merge branch 'macsec-offload-fixes' · f4e405f5
      David S. Miller authored
      Sabrina Dubroca says:
      
      ====================
      macsec: offload-related fixes
      
      I'm working on a dummy offload for macsec on netdevsim. It just has a
      small SecY and RXSC table so I can trigger failures easily on the
      ndo_* side. It has exposed a couple of issues.
      
      The first patch is a revert of commit c850240b ("net: macsec:
      report real_dev features when HW offloading is enabled"). That commit
      tried to improve the performance of macsec offload by taking advantage
      of some of the NIC's features, but in doing so, broke macsec offload
      when the lower device supports both macsec and ipsec offload, as the
      ipsec offload feature flags were copied from the real device. Since
      the macsec device doesn't provide xdo_* ops, the XFRM core rejects the
      registration of the new macsec device in xfrm_api_check.
      
      I'm working on re-adding those feature flags when offload is
      available, but I haven't fully solved that yet. I think it would be
      safer to do that second part in net-next considering how complex
      feature interactions tend to be.
      
      v2:
       - better describe the issue introduced by commit c850240b
      
       (Leon
         Romanovsky)
       - patch #3: drop unnecessary !! (Leon Romanovsky)
      
      v3:
       - patch #3: drop extra newline (Jakub Kicinski)
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f4e405f5
    • Sabrina Dubroca's avatar
      macsec: clear encryption keys from the stack after setting up offload · aaab73f8
      Sabrina Dubroca authored
      macsec_add_rxsa and macsec_add_txsa copy the key to an on-stack
      offloading context to pass it to the drivers, but leaves it there when
      it's done. Clear it with memzero_explicit as soon as it's not needed
      anymore.
      
      Fixes: 3cf3227a
      
       ("net: macsec: hardware offloading infrastructure")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aaab73f8
    • Sabrina Dubroca's avatar
      macsec: fix detection of RXSCs when toggling offloading · 80df4706
      Sabrina Dubroca authored
      macsec_is_configured incorrectly uses secy->n_rx_sc to check if some
      RXSCs exist. secy->n_rx_sc only counts the number of active RXSCs, but
      there can also be inactive SCs as well, which may be stored in the
      driver (in case we're disabling offloading), or would have to be
      pushed to the device (in case we're trying to enable offloading).
      
      As long as RXSCs active on creation and never turned off, the issue is
      not visible.
      
      Fixes: dcb780fb
      
       ("net: macsec: add nla support for changing the offloading selection")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      80df4706
    • Sabrina Dubroca's avatar
      macsec: fix secy->n_rx_sc accounting · 73a4b31c
      Sabrina Dubroca authored
      secy->n_rx_sc is supposed to be the number of _active_ rxsc's within a
      secy. This is then used by macsec_send_sci to help decide if we should
      add the SCI to the header or not.
      
      This logic is currently broken when we create a new RXSC and turn it
      off at creation, as create_rx_sc always sets ->active to true (and
      immediately uses that to increment n_rx_sc), and only later
      macsec_add_rxsc sets rx_sc->active.
      
      Fixes: c09440f7
      
       ("macsec: introduce IEEE 802.1AE driver")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73a4b31c
    • Sabrina Dubroca's avatar
      macsec: delete new rxsc when offload fails · 93a30947
      Sabrina Dubroca authored
      Currently we get an inconsistent state:
       - netlink returns the error to userspace
       - the RXSC is installed but not offloaded
      
      Then the device could get confused when we try to add an RXSA, because
      the RXSC isn't supposed to exist.
      
      Fixes: 3cf3227a
      
       ("net: macsec: hardware offloading infrastructure")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93a30947