Skip to content
  1. Nov 05, 2020
    • Heiner Kallweit's avatar
      r8169: work around short packet hw bug on RTL8125 · 2aaf09a0
      Heiner Kallweit authored
      Network problems with RTL8125B have been reported [0] and with help
      from Realtek it turned out that this chip version has a hw problem
      with short packets (similar to RTL8168evl). Having said that activate
      the same workaround as for RTL8168evl.
      Realtek suggested to activate the workaround for RTL8125A too, even
      though they're not 100% sure yet which RTL8125 versions are affected.
      
      [0] https://bugzilla.kernel.org/show_bug.cgi?id=209839
      
      Fixes: 0439297b
      
       ("r8169: add support for RTL8125B")
      Reported-by: default avatarMaxim Plotnikov <wgh@torlan.ru>
      Tested-by: default avatarMaxim Plotnikov <wgh@torlan.ru>
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Link: https://lore.kernel.org/r/8002c31a-60b9-58f1-f0dd-8fd07239917f@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2aaf09a0
    • Jakub Kicinski's avatar
      Merge tag 'linux-can-fixes-for-5.10-20201103' of... · ac6f929d
      Jakub Kicinski authored
      
      Merge tag 'linux-can-fixes-for-5.10-20201103' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can 2020-11-03
      
      The first two patches are by Oleksij Rempel and they add a generic
      can-controller Device Tree yaml binding and convert the text based binding
      of the flexcan driver to a yaml based binding.
      
      Zhang Changzhong's patch fixes a remove_proc_entry warning in the AF_CAN
      core.
      
      A patch by me fixes a kfree_skb() call from IRQ context in the rx-offload
      helper.
      
      Vincent Mailhol contributes a patch to prevent a call to kfree_skb() in
      hard IRQ context in can_get_echo_skb().
      
      Oliver Hartkopp's patch fixes the length calculation for RTR CAN frames
      in the __can_get_echo_skb() helper.
      
      Oleksij Rempel's patch fixes a use-after-free that shows up with j1939 in
      can_create_echo_skb().
      
      Yegor Yefremov contributes 4 patches to enhance the j1939 documentation.
      
      Zhang Changzhong's patch fixes a hanging task problem in j1939_sk_bind()
      if the netdev is down.
      
      Then there are three patches for the newly added CAN_ISOTP protocol. Geert
      Uytterhoeven enhances the kconfig help text. Oliver Hartkopp's patch adds
      missing RX timeout handling in listen-only mode and Colin Ian King's patch
      decreases the generated object code by 926 bytes.
      
      Zhang Changzhong contributes a patch for the ti_hecc driver that fixes the
      error path in the probe function.
      
      Navid Emamdoost's patch for the xilinx_can driver fixes the error handling
      in case of failing pm_runtime_get_sync().
      
      There are two patches for the peak_usb driver. Dan Carpenter adds range
      checking in decode operations and Stephane Grosjean's patch fixes
      a timestamp wrapping problem.
      
      Stephane Grosjean's patch for th peak_canfd driver fixes echo management if
      loopback is on.
      
      The next three patches all target the mcp251xfd driver. The first one is
      by me and it increased the severity of CRC read error messages. The kernel
      test robot removes an unneeded semicolon and Tom Rix removes unneeded
      break in several switch-cases.
      
      The last 4 patches are by Joakim Zhang and target the flexcan driver,
      the first three fix ECC related device specific quirks for the LS1021A,
      LX2160A and the VF610 SoC. The last patch disable wakeup completely upon
      driver remove.
      
      * tag 'linux-can-fixes-for-5.10-20201103' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: (27 commits)
        can: flexcan: flexcan_remove(): disable wakeup completely
        can: flexcan: add ECC initialization for VF610
        can: flexcan: add ECC initialization for LX2160A
        can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A
        can: mcp251xfd: remove unneeded break
        can: mcp251xfd: mcp251xfd_regmap_nocrc_read(): fix semicolon.cocci warnings
        can: mcp251xfd: mcp251xfd_regmap_crc_read(): increase severity of CRC read error messages
        can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on
        can: peak_usb: peak_usb_get_ts_time(): fix timestamp wrapping
        can: peak_usb: add range checking in decode operations
        can: xilinx_can: handle failure cases of pm_runtime_get_sync
        can: ti_hecc: ti_hecc_probe(): add missed clk_disable_unprepare() in error path
        can: isotp: padlen(): make const array static, makes object smaller
        can: isotp: isotp_rcv_cf(): enable RX timeout handling in listen-only mode
        can: isotp: Explain PDU in CAN_ISOTP help text
        can: j1939: j1939_sk_bind(): return failure if netdev is down
        can: j1939: use backquotes for code samples
        can: j1939: swap addr and pgn in the send example
        can: j1939: fix syntax and spelling
        can: j1939: rename jacd tool
        ...
      ====================
      
      Link: https://lore.kernel.org/r/<20201103220636.972106-1-mkl@pengutronix.de>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ac6f929d
    • Jakub Kicinski's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · 2da4c187
      Jakub Kicinski authored
      
      
      Steffen Klassert says:
      
      ====================
      1) Fix packet receiving of standard IP tunnels when the xfrm_interface
         module is installed. From Xin Long.
      
      2) Fix a race condition between spi allocating and hash list
         resizing. From zhuoliang zhang.
      ====================
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2da4c187
  2. Nov 04, 2020
    • Eelco Chaudron's avatar
      net: openvswitch: silence suspicious RCU usage warning · fea07a48
      Eelco Chaudron authored
      Silence suspicious RCU usage warning in ovs_flow_tbl_masks_cache_resize()
      by replacing rcu_dereference() with rcu_dereference_ovsl().
      
      In addition, when creating a new datapath, make sure it's configured under
      the ovs_lock.
      
      Fixes: 9bf24f59
      
       ("net: openvswitch: make masks cache size configurable")
      Reported-by: default avatar <syzbot+9a8f8bfcc56e8578016c@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Link: https://lore.kernel.org/r/160439190002.56943.1418882726496275961.stgit@ebuild
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fea07a48
    • Vinay Kumar Yadav's avatar
      chelsio/chtls: fix always leaking ctrl_skb · dbfe394d
      Vinay Kumar Yadav authored
      Correct skb refcount in alloc_ctrl_skb(), causing skb memleak
      when chtls_send_abort() called with NULL skb.
      it was always leaking the skb, correct it by incrementing skb
      refs by one.
      
      Fixes: cc35c88a
      
       ("crypto : chtls - CPL handler definition")
      Signed-off-by: default avatarVinay Kumar Yadav <vinay.yadav@chelsio.com>
      Link: https://lore.kernel.org/r/20201102173909.24826-1-vinay.yadav@chelsio.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dbfe394d
    • Vinay Kumar Yadav's avatar
      chelsio/chtls: fix memory leaks caused by a race · 8080b462
      Vinay Kumar Yadav authored
      race between user context and softirq causing memleak,
      consider the call sequence scenario
      
      chtls_setkey()         //user context
      chtls_peer_close()
      chtls_abort_req_rss()
      chtls_setkey()         //user context
      
      work request skb queued in chtls_setkey() won't be freed
      because resources are already cleaned for this connection,
      fix it by not queuing work request while socket is closing.
      
      v1->v2:
      - fix W=1 warning.
      
      v2->v3:
      - separate it out from another memleak fix.
      
      Fixes: cc35c88a
      
       ("crypto : chtls - CPL handler definition")
      Signed-off-by: default avatarVinay Kumar Yadav <vinay.yadav@chelsio.com>
      Link: https://lore.kernel.org/r/20201102173650.24754-1-vinay.yadav@chelsio.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8080b462
    • Joakim Zhang's avatar
      can: flexcan: flexcan_remove(): disable wakeup completely · ab07ff1c
      Joakim Zhang authored
      With below sequence, we can see wakeup default is enabled after re-load module,
      if it was enabled before, so we need disable wakeup in flexcan_remove().
      
      | # cat /sys/bus/platform/drivers/flexcan/5a8e0000.can/power/wakeup
      | disabled
      | # echo enabled > /sys/bus/platform/drivers/flexcan/5a8e0000.can/power/wakeup
      | # cat /sys/bus/platform/drivers/flexcan/5a8e0000.can/power/wakeup
      | enabled
      | # rmmod flexcan
      | # modprobe flexcan
      | # cat /sys/bus/platform/drivers/flexcan/5a8e0000.can/power/wakeup
      | enabled
      
      Fixes: de3578c1 ("can: flexcan: add self wakeup support")
      Fixes: 915f9666
      
       ("can: flexcan: add support for DT property 'wakeup-source'")
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20201020184527.8190-1-qiangqing.zhang@nxp.com
      [mkl: streamlined commit message]
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      ab07ff1c
    • Joakim Zhang's avatar
      can: flexcan: add ECC initialization for VF610 · 5fdf04a9
      Joakim Zhang authored
      For SoCs with ECC supported, even use FLEXCAN_QUIRK_DISABLE_MECR quirk to
      disable non-correctable errors interrupt and freeze mode, had better use
      FLEXCAN_QUIRK_SUPPORT_ECC quirk to initialize all memory.
      
      Fixes: cdce8448
      
       ("can: flexcan: add vf610 support for FlexCAN")
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20201020155402.30318-6-qiangqing.zhang@nxp.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      5fdf04a9
    • Joakim Zhang's avatar
      can: flexcan: add ECC initialization for LX2160A · 91a22bfe
      Joakim Zhang authored
      After double check with Layerscape CAN owner (Pankaj Bansal), confirm
      that LX2160A indeed supports ECC feature, so correct the feature table.
      
      For SoCs with ECC supported, even use FLEXCAN_QUIRK_DISABLE_MECR quirk to
      disable non-correctable errors interrupt and freeze mode, had better use
      FLEXCAN_QUIRK_SUPPORT_ECC quirk to initialize all memory.
      
      Fixes: 2c19bb43
      
       ("can: flexcan: add lx2160ar1 support")
      Cc: Pankaj Bansal <pankaj.bansal@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20201020155402.30318-5-qiangqing.zhang@nxp.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      91a22bfe
    • Joakim Zhang's avatar
      can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A · 01879964
      Joakim Zhang authored
      After double check with Layerscape CAN owner (Pankaj Bansal), confirm that
      LS1021A doesn't support ECC feature, so remove FLEXCAN_QUIRK_DISABLE_MECR
      quirk.
      
      Fixes: 99b7668c
      
       ("can: flexcan: adding platform specific details for LS1021A")
      Cc: Pankaj Bansal <pankaj.bansal@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20201020155402.30318-4-qiangqing.zhang@nxp.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      01879964
    • Tom Rix's avatar
      can: mcp251xfd: remove unneeded break · 78db1aa8
      Tom Rix authored
      
      
      A break is not needed if it is preceded by a return.
      
      Signed-off-by: default avatarTom Rix <trix@redhat.com>
      Link: https://lore.kernel.org/r/20201019172412.31143-1-trix@redhat.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      78db1aa8
    • kernel test robot's avatar
      can: mcp251xfd: mcp251xfd_regmap_nocrc_read(): fix semicolon.cocci warnings · da623840
      kernel test robot authored
      drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c:176:2-3: Unneeded semicolon
      
       Remove unneeded semicolon.
      
      Generated by: scripts/coccinelle/misc/semicolon.cocci
      
      Fixes: 875347fe
      
       ("can: mcp25xxfd: add regmap infrastructure")
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/r/20201019120805.GA63693@ae4257e0ab22
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      da623840
    • Marc Kleine-Budde's avatar
      can: mcp251xfd: mcp251xfd_regmap_crc_read(): increase severity of CRC read error messages · b4728920
      Marc Kleine-Budde authored
      
      
      During debugging it turned out that some people have setups where the SPI
      communication is more prone to CRC errors.
      
      Increase the severity of both the transfer retry and transfer failure message
      to give users feedback without the need to recompile the driver with debug
      enabled.
      
      Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Cc: Thomas Kopp <thomas.kopp@microchip.com>
      Link: http://lore.kernel.org/r/20201019190524.1285319-15-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      b4728920
    • Stephane Grosjean's avatar
      can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on · 93ef65e5
      Stephane Grosjean authored
      
      
      Echo management is driven by PUCAN_MSG_LOOPED_BACK bit, while loopback
      frames are identified with PUCAN_MSG_SELF_RECEIVE bit. Those bits are set
      for each outgoing frame written to the IP core so that a copy of each one
      will be placed into the rx path. Thus,
      
      - when PUCAN_MSG_LOOPED_BACK is set then the rx frame is an echo of a
        previously sent frame,
      - when PUCAN_MSG_LOOPED_BACK+PUCAN_MSG_SELF_RECEIVE are set, then the rx
        frame is an echo AND a loopback frame. Therefore, this frame must be
        put into the socket rx path too.
      
      This patch fixes how CAN frames are handled when these are sent while the
      can interface is configured in "loopback on" mode.
      
      Signed-off-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
      Link: https://lore.kernel.org/r/20201013153947.28012-1-s.grosjean@peak-system.com
      Fixes: 8ac8321e
      
       ("can: peak: add support for PEAK PCAN-PCIe FD CAN-FD boards")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      93ef65e5
    • Stephane Grosjean's avatar
      can: peak_usb: peak_usb_get_ts_time(): fix timestamp wrapping · ecc7b418
      Stephane Grosjean authored
      
      
      Fabian Inostroza <fabianinostrozap@gmail.com> has discovered a potential
      problem in the hardware timestamp reporting from the PCAN-USB USB CAN interface
      (only), related to the fact that a timestamp of an event may precede the
      timestamp used for synchronization when both records are part of the same USB
      packet. However, this case was used to detect the wrapping of the time counter.
      
      This patch details and fixes the two identified cases where this problem can
      occur.
      
      Reported-by: default avatarFabian Inostroza <fabianinostrozap@gmail.com>
      Signed-off-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
      Link: https://lore.kernel.org/r/20201014085631.15128-1-s.grosjean@peak-system.com
      Fixes: bb478555
      
       ("can: usb: PEAK-System Technik USB adapters driver core")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      ecc7b418
    • Dan Carpenter's avatar
      can: peak_usb: add range checking in decode operations · a6921dd5
      Dan Carpenter authored
      These values come from skb->data so Smatch considers them untrusted.  I
      believe Smatch is correct but I don't have a way to test this.
      
      The usb_if->dev[] array has 2 elements but the index is in the 0-15
      range without checks.  The cfd->len can be up to 255 but the maximum
      valid size is CANFD_MAX_DLEN (64) so that could lead to memory
      corruption.
      
      Fixes: 0a25e1f4
      
       ("can: peak_usb: add support for PEAK new CANFD USB adapters")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20200813140604.GA456946@mwanda
      Acked-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      a6921dd5
    • Navid Emamdoost's avatar
      can: xilinx_can: handle failure cases of pm_runtime_get_sync · 79c43333
      Navid Emamdoost authored
      
      
      Calling pm_runtime_get_sync increments the counter even in case of
      failure, causing incorrect ref count. Call pm_runtime_put if
      pm_runtime_get_sync fails.
      
      Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
      Link: https://lore.kernel.org/r/20200605033239.60664-1-navid.emamdoost@gmail.com
      Fixes: 4716620d
      
       ("can: xilinx: Convert to runtime_pm")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      79c43333
    • Zhang Changzhong's avatar
      can: ti_hecc: ti_hecc_probe(): add missed clk_disable_unprepare() in error path · e002103b
      Zhang Changzhong authored
      
      
      The driver forgets to call clk_disable_unprepare() in error path after
      a success calling for clk_prepare_enable().
      
      Fix it by adding a clk_disable_unprepare() in error path.
      
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Link: https://lore.kernel.org/r/1594973079-27743-1-git-send-email-zhangchangzhong@huawei.com
      Fixes: befa6011
      
       ("can: ti_hecc: add missing prepare and unprepare of the clock")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      e002103b
    • Colin Ian King's avatar
      can: isotp: padlen(): make const array static, makes object smaller · c3ddac4b
      Colin Ian King authored
      
      
      Don't populate the const array plen on the stack but instead it static. Makes
      the object code smaller by 926 bytes.
      
      Before:
         text	   data	    bss	    dec	    hex	filename
        26531	   1943	     64	  28538	   6f7a	net/can/isotp.o
      
      After:
         text	   data	    bss	    dec	    hex	filename
        25509	   2039	     64	  27612	   6bdc	net/can/isotp.o
      
      (gcc version 10.2.0)
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Link: https://lore.kernel.org/r/20201020154203.54711-1-colin.king@canonical.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      c3ddac4b
    • Oliver Hartkopp's avatar
      can: isotp: isotp_rcv_cf(): enable RX timeout handling in listen-only mode · 78656ea2
      Oliver Hartkopp authored
      
      
      As reported by Thomas Wagner:
      
          https://github.com/hartkopp/can-isotp/issues/34
      
      the timeout handling for data frames is not enabled when the isotp socket is
      used in listen-only mode (sockopt CAN_ISOTP_LISTEN_MODE). This mode is enabled
      by the isotpsniffer application which therefore became inconsistend with the
      strict rx timeout rules when running the isotp protocol in the operational
      mode.
      
      This patch fixes this inconsistency by moving the return condition for the
      listen-only mode behind the timeout handling code.
      
      Reported-by: default avatarThomas Wagner <thwa1@web.de>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Fixes: e057dd3f
      
       ("can: add ISO 15765-2:2016 transport protocol")
      Link: https://github.com/hartkopp/can-isotp/issues/34
      Link: https://lore.kernel.org/r/20201019120229.89326-1-socketcan@hartkopp.net
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      78656ea2
    • Geert Uytterhoeven's avatar
      can: isotp: Explain PDU in CAN_ISOTP help text · 5a7de240
      Geert Uytterhoeven authored
      
      
      The help text for the CAN_ISOTP config symbol uses the acronym "PDU".  However,
      this acronym is not explained here, nor in Documentation/networking/can.rst.
      
      Expand the acronym to make it easier for users to decide if they need to enable
      the CAN_ISOTP option or not.
      
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20201013141341.28487-1-geert+renesas@glider.be
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      5a7de240
    • Zhang Changzhong's avatar
      can: j1939: j1939_sk_bind(): return failure if netdev is down · 08c487d8
      Zhang Changzhong authored
      When a netdev down event occurs after a successful call to
      j1939_sk_bind(), j1939_netdev_notify() can handle it correctly.
      
      But if the netdev already in down state before calling j1939_sk_bind(),
      j1939_sk_release() will stay in wait_event_interruptible() blocked
      forever. Because in this case, j1939_netdev_notify() won't be called and
      j1939_tp_txtimer() won't call j1939_session_cancel() or other function
      to clear session for ENETDOWN error, this lead to mismatch of
      j1939_session_get/put() and jsk->skb_pending will never decrease to
      zero.
      
      To reproduce it use following commands:
      1. ip link add dev vcan0 type vcan
      2. j1939acd -r 100,80-120 1122334455667788 vcan0
      3. presses ctrl-c and thread will be blocked forever
      
      This patch adds check for ndev->flags in j1939_sk_bind() to avoid this
      kind of situation and return with -ENETDOWN.
      
      Fixes: 9d71dd0c
      
       ("can: add support of SAE J1939 protocol")
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Link: https://lore.kernel.org/r/1599460308-18770-1-git-send-email-zhangchangzhong@huawei.com
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      08c487d8
    • Yegor Yefremov's avatar
      can: j1939: use backquotes for code samples · a39372c2
      Yegor Yefremov authored
      
      
      This patch adds backquotes for code samples.
      
      Signed-off-by: default avatarYegor Yefremov <yegorslists@googlemail.com>
      Link: https://lore.kernel.org/r/20201026094442.16587-1-yegorslists@googlemail.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      a39372c2
    • Yegor Yefremov's avatar
      can: j1939: swap addr and pgn in the send example · ea780d39
      Yegor Yefremov authored
      
      
      The address was wrongly assigned to the PGN field and vice versa.
      
      Signed-off-by: default avatarYegor Yefremov <yegorslists@googlemail.com>
      Link: https://lore.kernel.org/r/20201022083708.8755-1-yegorslists@googlemail.com
      Fixes: 9d71dd0c
      
       ("can: add support of SAE J1939 protocol")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      ea780d39
    • Yegor Yefremov's avatar
      can: j1939: fix syntax and spelling · 864a2756
      Yegor Yefremov authored
      
      
      This patches fixes the syntax an spelling of the j1939 documentation.
      
      Signed-off-by: default avatarYegor Yefremov <yegorslists@googlemail.com>
      Link: https://lore.kernel.org/r/20201020101043.6369-1-yegorslists@googlemail.com
      Fixes: 9d71dd0c
      
       ("can: add support of SAE J1939 protocol")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      864a2756
    • Yegor Yefremov's avatar
      can: j1939: rename jacd tool · 429efa6e
      Yegor Yefremov authored
      
      
      Due to naming conflicts, jacd was renamed to j1939acd in:
      
          https://github.com/linux-can/can-utils/pull/199
      
      Signed-off-by: default avatarYegor Yefremov <yegorslists@googlemail.com>
      Link: https://lore.kernel.org/r/20201020081134.3597-1-yegorslists@googlemail.com
      Link: https://github.com/linux-can/can-utils/pull/199
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      429efa6e
    • Oleksij Rempel's avatar
      can: can_create_echo_skb(): fix echo skb generation: always use skb_clone() · 286228d3
      Oleksij Rempel authored
      All user space generated SKBs are owned by a socket (unless injected into the
      key via AF_PACKET). If a socket is closed, all associated skbs will be cleaned
      up.
      
      This leads to a problem when a CAN driver calls can_put_echo_skb() on a
      unshared SKB. If the socket is closed prior to the TX complete handler,
      can_get_echo_skb() and the subsequent delivering of the echo SKB to all
      registered callbacks, a SKB with a refcount of 0 is delivered.
      
      To avoid the problem, in can_get_echo_skb() the original SKB is now always
      cloned, regardless of shared SKB or not. If the process exists it can now
      safely discard its SKBs, without disturbing the delivery of the echo SKB.
      
      The problem shows up in the j1939 stack, when it clones the incoming skb, which
      detects the already 0 refcount.
      
      We can easily reproduce this with following example:
      
      testj1939 -B -r can0: &
      cansend can0 1823ff40#0123
      
      WARNING: CPU: 0 PID: 293 at lib/refcount.c:25 refcount_warn_saturate+0x108/0x174
      refcount_t: addition on 0; use-after-free.
      Modules linked in: coda_vpu imx_vdoa videobuf2_vmalloc dw_hdmi_ahb_audio vcan
      CPU: 0 PID: 293 Comm: cansend Not tainted 5.5.0-rc6-00376-g9e20dcb7040d #1
      Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      Backtrace:
      [<c010f570>] (dump_backtrace) from [<c010f90c>] (show_stack+0x20/0x24)
      [<c010f8ec>] (show_stack) from [<c0c3e1a4>] (dump_stack+0x8c/0xa0)
      [<c0c3e118>] (dump_stack) from [<c0127fec>] (__warn+0xe0/0x108)
      [<c0127f0c>] (__warn) from [<c01283c8>] (warn_slowpath_fmt+0xa8/0xcc)
      [<c0128324>] (warn_slowpath_fmt) from [<c0539c0c>] (refcount_warn_saturate+0x108/0x174)
      [<c0539b04>] (refcount_warn_saturate) from [<c0ad2cac>] (j1939_can_recv+0x20c/0x210)
      [<c0ad2aa0>] (j1939_can_recv) from [<c0ac9dc8>] (can_rcv_filter+0xb4/0x268)
      [<c0ac9d14>] (can_rcv_filter) from [<c0aca2cc>] (can_receive+0xb0/0xe4)
      [<c0aca21c>] (can_receive) from [<c0aca348>] (can_rcv+0x48/0x98)
      [<c0aca300>] (can_rcv) from [<c09b1fdc>] (__netif_receive_skb_one_core+0x64/0x88)
      [<c09b1f78>] (__netif_receive_skb_one_core) from [<c09b2070>] (__netif_receive_skb+0x38/0x94)
      [<c09b2038>] (__netif_receive_skb) from [<c09b2130>] (netif_receive_skb_internal+0x64/0xf8)
      [<c09b20cc>] (netif_receive_skb_internal) from [<c09b21f8>] (netif_receive_skb+0x34/0x19c)
      [<c09b21c4>] (netif_receive_skb) from [<c0791278>] (can_rx_offload_napi_poll+0x58/0xb4)
      
      Fixes: 0ae89beb
      
       ("can: add destructor for self generated skbs")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: http://lore.kernel.org/r/20200124132656.22156-1-o.rempel@pengutronix.de
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      286228d3
    • Oliver Hartkopp's avatar
      can: dev: __can_get_echo_skb(): fix real payload length return value for RTR frames · ed3320ce
      Oliver Hartkopp authored
      
      
      The can_get_echo_skb() function returns the number of received bytes to
      be used for netdev statistics. In the case of RTR frames we get a valid
      (potential non-zero) data length value which has to be passed for further
      operations. But on the wire RTR frames have no payload length. Therefore
      the value to be used in the statistics has to be zero for RTR frames.
      
      Reported-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/r/20201020064443.80164-1-socketcan@hartkopp.net
      Fixes: cf5046b3
      
       ("can: dev: let can_get_echo_skb() return dlc of CAN frame")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      ed3320ce
    • Vincent Mailhol's avatar
      can: dev: can_get_echo_skb(): prevent call to kfree_skb() in hard IRQ context · 2283f79b
      Vincent Mailhol authored
      
      
      If a driver calls can_get_echo_skb() during a hardware IRQ (which is often, but
      not always, the case), the 'WARN_ON(in_irq)' in
      net/core/skbuff.c#skb_release_head_state() might be triggered, under network
      congestion circumstances, together with the potential risk of a NULL pointer
      dereference.
      
      The root cause of this issue is the call to kfree_skb() instead of
      dev_kfree_skb_irq() in net/core/dev.c#enqueue_to_backlog().
      
      This patch prevents the skb to be freed within the call to netif_rx() by
      incrementing its reference count with skb_get(). The skb is finally freed by
      one of the in-irq-context safe functions: dev_consume_skb_any() or
      dev_kfree_skb_any(). The "any" version is used because some drivers might call
      can_get_echo_skb() in a normal context.
      
      The reason for this issue to occur is that initially, in the core network
      stack, loopback skb were not supposed to be received in hardware IRQ context.
      The CAN stack is an exeption.
      
      This bug was previously reported back in 2017 in [1] but the proposed patch
      never got accepted.
      
      While [1] directly modifies net/core/dev.c, we try to propose here a
      smoother modification local to CAN network stack (the assumption
      behind is that only CAN devices are affected by this issue).
      
      [1] http://lore.kernel.org/r/57a3ffb6-3309-3ad5-5a34-e93c3fe3614d@cetitec.com
      
      Signed-off-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Link: https://lore.kernel.org/r/20201002154219.4887-2-mailhol.vincent@wanadoo.fr
      Fixes: 39549eef
      
       ("can: CAN Network device driver and Netlink interface")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      2283f79b
    • Marc Kleine-Budde's avatar
      can: rx-offload: don't call kfree_skb() from IRQ context · 2ddd6bfe
      Marc Kleine-Budde authored
      A CAN driver, using the rx-offload infrastructure, is reading CAN frames
      (usually in IRQ context) from the hardware and placing it into the rx-offload
      queue to be delivered to the networking stack via NAPI.
      
      In case the rx-offload queue is full, trying to add more skbs results in the
      skbs being dropped using kfree_skb(). If done from hard-IRQ context this
      results in the following warning:
      
      [  682.552693] ------------[ cut here ]------------
      [  682.557360] WARNING: CPU: 0 PID: 3057 at net/core/skbuff.c:650 skb_release_head_state+0x74/0x84
      [  682.566075] Modules linked in: can_raw can coda_vpu flexcan dw_hdmi_ahb_audio v4l2_jpeg imx_vdoa can_dev
      [  682.575597] CPU: 0 PID: 3057 Comm: cansend Tainted: G        W         5.7.0+ #18
      [  682.583098] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      [  682.589657] [<c0112628>] (unwind_backtrace) from [<c010c1c4>] (show_stack+0x10/0x14)
      [  682.597423] [<c010c1c4>] (show_stack) from [<c06c481c>] (dump_stack+0xe0/0x114)
      [  682.604759] [<c06c481c>] (dump_stack) from [<c0128f10>] (__warn+0xc0/0x10c)
      [  682.611742] [<c0128f10>] (__warn) from [<c0129314>] (warn_slowpath_fmt+0x5c/0xc0)
      [  682.619248] [<c0129314>] (warn_slowpath_fmt) from [<c0b95dec>] (skb_release_head_state+0x74/0x84)
      [  682.628143] [<c0b95dec>] (skb_release_head_state) from [<c0b95e08>] (skb_release_all+0xc/0x24)
      [  682.636774] [<c0b95e08>] (skb_release_all) from [<c0b95eac>] (kfree_skb+0x74/0x1c8)
      [  682.644479] [<c0b95eac>] (kfree_skb) from [<bf001d1c>] (can_rx_offload_queue_sorted+0xe0/0xe8 [can_dev])
      [  682.654051] [<bf001d1c>] (can_rx_offload_queue_sorted [can_dev]) from [<bf001d6c>] (can_rx_offload_get_echo_skb+0x48/0x94 [can_dev])
      [  682.666007] [<bf001d6c>] (can_rx_offload_get_echo_skb [can_dev]) from [<bf01efe4>] (flexcan_irq+0x194/0x5dc [flexcan])
      [  682.676734] [<bf01efe4>] (flexcan_irq [flexcan]) from [<c019c1ec>] (__handle_irq_event_percpu+0x4c/0x3ec)
      [  682.686322] [<c019c1ec>] (__handle_irq_event_percpu) from [<c019c5b8>] (handle_irq_event_percpu+0x2c/0x88)
      [  682.695993] [<c019c5b8>] (handle_irq_event_percpu) from [<c019c64c>] (handle_irq_event+0x38/0x5c)
      [  682.704887] [<c019c64c>] (handle_irq_event) from [<c01a1058>] (handle_fasteoi_irq+0xc8/0x180)
      [  682.713432] [<c01a1058>] (handle_fasteoi_irq) from [<c019b2c0>] (generic_handle_irq+0x30/0x44)
      [  682.722063] [<c019b2c0>] (generic_handle_irq) from [<c019b8f8>] (__handle_domain_irq+0x64/0xdc)
      [  682.730783] [<c019b8f8>] (__handle_domain_irq) from [<c06df4a4>] (gic_handle_irq+0x48/0x9c)
      [  682.739158] [<c06df4a4>] (gic_handle_irq) from [<c0100b30>] (__irq_svc+0x70/0x98)
      [  682.746656] Exception stack(0xe80e9dd8 to 0xe80e9e20)
      [  682.751725] 9dc0:                                                       00000001 e80e8000
      [  682.759922] 9de0: e820cf80 00000000 ffffe000 00000000 eaf08fe4 00000000 600d0013 00000000
      [  682.768117] 9e00: c1732e3c c16093a8 e820d4c0 e80e9e28 c018a57c c018b870 600d0013 ffffffff
      [  682.776315] [<c0100b30>] (__irq_svc) from [<c018b870>] (lock_acquire+0x108/0x4e8)
      [  682.783821] [<c018b870>] (lock_acquire) from [<c0e938e4>] (down_write+0x48/0xa8)
      [  682.791242] [<c0e938e4>] (down_write) from [<c02818dc>] (unlink_file_vma+0x24/0x40)
      [  682.798922] [<c02818dc>] (unlink_file_vma) from [<c027a258>] (free_pgtables+0x34/0xb8)
      [  682.806858] [<c027a258>] (free_pgtables) from [<c02835a4>] (exit_mmap+0xe4/0x170)
      [  682.814361] [<c02835a4>] (exit_mmap) from [<c01248e0>] (mmput+0x5c/0x110)
      [  682.821171] [<c01248e0>] (mmput) from [<c012e910>] (do_exit+0x374/0xbe4)
      [  682.827892] [<c012e910>] (do_exit) from [<c0130888>] (do_group_exit+0x38/0xb4)
      [  682.835132] [<c0130888>] (do_group_exit) from [<c0130914>] (__wake_up_parent+0x0/0x14)
      [  682.843063] irq event stamp: 1936
      [  682.846399] hardirqs last  enabled at (1935): [<c02938b0>] rmqueue+0xf4/0xc64
      [  682.853553] hardirqs last disabled at (1936): [<c0100b20>] __irq_svc+0x60/0x98
      [  682.860799] softirqs last  enabled at (1878): [<bf04cdcc>] raw_release+0x108/0x1f0 [can_raw]
      [  682.869256] softirqs last disabled at (1876): [<c0b8f478>] release_sock+0x18/0x98
      [  682.876753] ---[ end trace 7bca4751ce44c444 ]---
      
      This patch fixes the problem by replacing the kfree_skb() by
      dev_kfree_skb_any(), as rx-offload might be called from threaded IRQ handlers
      as well.
      
      Fixes: ca913f1a ("can: rx-offload: can_rx_offload_queue_sorted(): fix error handling, avoid skb mem leak")
      Fixes: 6caf8a6d
      
       ("can: rx-offload: can_rx_offload_queue_tail(): fix error handling, avoid skb mem leak")
      Link: http://lore.kernel.org/r/20201019190524.1285319-3-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      2ddd6bfe
    • Zhang Changzhong's avatar
      can: proc: can_remove_proc(): silence remove_proc_entry warning · 3accbfdc
      Zhang Changzhong authored
      
      
      If can_init_proc() fail to create /proc/net/can directory, can_remove_proc()
      will trigger a warning:
      
      WARNING: CPU: 6 PID: 7133 at fs/proc/generic.c:672 remove_proc_entry+0x17b0
      Kernel panic - not syncing: panic_on_warn set ...
      
      Fix to return early from can_remove_proc() if can proc_dir does not exists.
      
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Link: https://lore.kernel.org/r/1594709090-3203-1-git-send-email-zhangchangzhong@huawei.com
      Fixes: 8e8cda6d
      
       ("can: initial support for network namespaces")
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      3accbfdc
    • Oleksij Rempel's avatar
      dt-bindings: can: flexcan: convert fsl,*flexcan bindings to yaml · e5ab9aa7
      Oleksij Rempel authored
      
      
      In order to automate the verification of DT nodes convert
      fsl-flexcan.txt to fsl,flexcan.yaml
      
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Link: https://lore.kernel.org/r/20201022075218.11880-3-o.rempel@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      e5ab9aa7
    • Oleksij Rempel's avatar
      dt-bindings: can: add can-controller.yaml · 1f923440
      Oleksij Rempel authored
      
      
      For now we have only node name as common rule for all CAN controllers
      
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Link: https://lore.kernel.org/r/20201022075218.11880-2-o.rempel@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      1f923440
    • Daniele Palmas's avatar
      net: usb: qmi_wwan: add Telit LE910Cx 0x1230 composition · 5fd8477e
      Daniele Palmas authored
      
      
      Add support for Telit LE910Cx 0x1230 composition:
      
      0x1230: tty, adb, rmnet, audio, tty, tty, tty, tty
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20201102110108.17244-1-dnlplm@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5fd8477e
    • Davide Caratti's avatar
      mptcp: token: fix unititialized variable · e16b874e
      Davide Caratti authored
      gcc complains about use of uninitialized 'num'. Fix it by doing the first
      assignment of 'num' when the variable is declared.
      
      Fixes: 96d890da
      
       ("mptcp: add msk interations helper")
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Link: https://lore.kernel.org/r/49e20da5d467a73414d4294a8bd35e2cb1befd49.1604308087.git.dcaratti@redhat.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e16b874e
  3. Nov 03, 2020
    • YueHaibing's avatar
      sfp: Fix error handing in sfp_probe() · 96216181
      YueHaibing authored
      gpiod_to_irq() never return 0, but returns negative in
      case of error, check it and set gpio_irq to 0.
      
      Fixes: 73970055
      
       ("sfp: add SFP module support")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201031031053.25264-1-yuehaibing@huawei.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      96216181
    • Sukadev Bhattiprolu's avatar
      powerpc/vnic: Extend "failover pending" window · 1d850493
      Sukadev Bhattiprolu authored
      Commit 5a18e1e0 introduced the 'failover_pending' state to track
      the "failover pending window" - where we wait for the partner to become
      ready (after a transport event) before actually attempting to failover.
      i.e window is between following two events:
      
              a. we get a transport event due to a FAILOVER
      
              b. later, we get CRQ_INITIALIZED indicating the partner is
                 ready  at which point we schedule a FAILOVER reset.
      
      and ->failover_pending is true during this window.
      
      If during this window, we attempt to open (or close) a device, we pretend
      that the operation succeded and let the FAILOVER reset path complete the
      operation.
      
      This is fine, except if the transport event ("a" above) occurs during the
      open and after open has already checked whether a failover is pending. If
      that happens, we fail the open, which can cause the boot scripts to leave
      the interface down requiring administrator to manually bring up the device.
      
      This fix "extends" the failover pending window till we are _actually_
      ready to perform the failover reset (i.e until after we get the RTNL
      lock). Since open() holds the RTNL lock, we can be sure that we either
      finish the open or if the open() fails due to the failover pending window,
      we can again pretend that open is done and let the failover complete it.
      
      We could try and block the open until failover is completed but a) that
      could still timeout the application and b) Existing code "pretends" that
      failover occurred "just after" open succeeded, so marks the open successful
      and lets the failover complete the open. So, mark the open successful even
      if the transport event occurs before we actually start the open.
      
      Fixes: 5a18e1e0
      
       ("ibmvnic: Fix failover case for non-redundant configuration")
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.ibm.com>
      Acked-by: default avatarDany Madden <drt@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201030170711.1562994-1-sukadev@linux.ibm.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1d850493
    • Jonathan McDowell's avatar
      net: dsa: qca8k: Fix port MTU setting · 99cab710
      Jonathan McDowell authored
      
      
      The qca8k only supports a switch-wide MTU setting, and the code to take
      the max of all ports was only looking at the port currently being set.
      Fix to examine all ports.
      
      Reported-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Fixes: f58d2598
      
       ("net: dsa: qca8k: implement the port MTU callbacks")
      Signed-off-by: default avatarJonathan McDowell <noodles@earth.li>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201030183315.GA6736@earth.li
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      99cab710
    • Petr Malat's avatar
      sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms · b6df8c81
      Petr Malat authored
      Commit 978aa047 ("sctp: fix some type cast warnings introduced since
      very beginning")' broke err reading from sctp_arg, because it reads the
      value as 32-bit integer, although the value is stored as 16-bit integer.
      Later this value is passed to the userspace in 16-bit variable, thus the
      user always gets 0 on big-endian platforms. Fix it by reading the __u16
      field of sctp_arg union, as reading err field would produce a sparse
      warning.
      
      Fixes: 978aa047
      
       ("sctp: fix some type cast warnings introduced since very beginning")
      Signed-off-by: default avatarPetr Malat <oss@malat.biz>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Link: https://lore.kernel.org/r/20201030132633.7045-1-oss@malat.biz
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b6df8c81
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpsw: disable PTPv1 hw timestamping advertisement · 0a26ba06
      Grygorii Strashko authored
      The TI CPTS does not natively support PTPv1, only PTPv2. But, as it
      happens, the CPTS can provide HW timestamp for PTPv1 Sync messages, because
      CPTS HW parser looks for PTP messageType id in PTP message octet 0 which
      value is 0 for PTPv1. As result, CPTS HW can detect Sync messages for PTPv1
      and PTPv2 (Sync messageType = 0 for both), but it fails for any other PTPv1
      messages (Delay_req/resp) and will return PTP messageType id 0 for them.
      
      The commit e9523a5a ("net: ethernet: ti: cpsw: enable
      HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter") added PTPv1 hw timestamping
      advertisement by mistake, only to make Linux Kernel "timestamping" utility
      work, and this causes issues with only PTPv1 compatible HW/SW - Sync HW
      timestamped, but Delay_req/resp are not.
      
      Hence, fix it disabling PTPv1 hw timestamping advertisement, so only PTPv1
      compatible HW/SW can properly roll back to SW timestamping.
      
      Fixes: e9523a5a
      
       ("net: ethernet: ti: cpsw: enable HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter")
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Link: https://lore.kernel.org/r/20201029190910.30789-1-grygorii.strashko@ti.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0a26ba06