Skip to content
  1. Nov 18, 2020
  2. Nov 17, 2020
  3. Nov 16, 2020
    • Jakub Kicinski's avatar
      Merge tag 'linux-can-fixes-for-5.10-20201115' of... · e2142ef2
      Jakub Kicinski authored
      
      Merge tag 'linux-can-fixes-for-5.10-20201115' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can 2020-11-15
      
      Anant Thazhemadam contributed two patches for the AF_CAN that prevent potential
      access of uninitialized member in can_rcv() and canfd_rcv().
      
      The next patch is by Alejandro Concepcion Rodriguez and changes can_restart()
      to use the correct function to push a skb into the networking stack from
      process context.
      
      Zhang Qilong's patch fixes a memory leak in the error path of the ti_hecc's
      probe function.
      
      A patch by me fixes mcba_usb_start_xmit() function in the mcba_usb driver, to
      first fill the skb and then pass it to can_put_echo_skb().
      
      Colin Ian King's patch fixes a potential integer overflow on shift in the
      peak_usb driver.
      
      The next two patches target the flexcan driver, a patch by me adds the missing
      "req_bit" to the stop mode property comment (which was broken during net-next
      for v5.10). Zhang Qilong's patch fixes the failure handling of
      pm_runtime_get_sync().
      
      The next seven patches target the m_can driver including the tcan4x5x spi
      driver glue code. Enric Balletbo i Serra's patch for the tcan4x5x Kconfig fix
      the REGMAP_SPI dependency handling. A patch by me for the tcan4x5x driver's
      probe() function adds missing error handling to for devm_regmap_init(), and in
      tcan4x5x_can_remove() the order of deregistration is fixed. Wu Bo's patch for
      the m_can driver fixes the state change handling in
      m_can_handle_state_change(). Two patches by Dan Murphy first introduce
      m_can_class_free_dev() and then make use of it to fix the freeing of the can
      device. A patch by Faiz Abbas add a missing shutdown of the CAN controller in
      the m_can_stop() function.
      
      * tag 'linux-can-fixes-for-5.10-20201115' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
        can: m_can: m_can_stop(): set device to software init mode before closing
        can: m_can: Fix freeing of can device from peripherials
        can: m_can: m_can_class_free_dev(): introduce new function
        can: m_can: m_can_handle_state_change(): fix state change
        can: tcan4x5x: tcan4x5x_can_remove(): fix order of deregistration
        can: tcan4x5x: tcan4x5x_can_probe(): add missing error checking for devm_regmap_init()
        can: tcan4x5x: replace depends on REGMAP_SPI with depends on SPI
        can: flexcan: fix failure handling of pm_runtime_get_sync()
        can: flexcan: flexcan_setup_stop_mode(): add missing "req_bit" to stop mode property comment
        can: peak_usb: fix potential integer overflow on shift of a int
        can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb()
        can: ti_hecc: Fix memleak in ti_hecc_probe
        can: dev: can_restart(): post buffer from the right context
        can: af_can: prevent potential access of uninitialized member in canfd_rcv()
        can: af_can: prevent potential access of uninitialized member in can_rcv()
      ====================
      
      Link: https://lore.kernel.org/r/20201115174131.2089251-1-mkl@pengutronix.de
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e2142ef2
    • Faiz Abbas's avatar
      can: m_can: m_can_stop(): set device to software init mode before closing · a584e9bc
      Faiz Abbas authored
      There might be some requests pending in the buffer when the interface close
      sequence occurs. In some devices, these pending requests might lead to the
      module not shutting down properly when m_can_clk_stop() is called.
      
      Therefore, move the device to init state before potentially powering it down.
      
      Fixes: e0d1f481
      
       ("can: m_can: add Bosch M_CAN controller support")
      Signed-off-by: default avatarFaiz Abbas <faiz_abbas@ti.com>
      Acked-by: default avatarDan Murphy <dmurphy@ti.com>
      Link: https://lore.kernel.org/r/20200825055442.16994-1-faiz_abbas@ti.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      a584e9bc
    • Dan Murphy's avatar
      can: m_can: Fix freeing of can device from peripherials · 85816aba
      Dan Murphy authored
      Fix leaking netdev device from peripherial devices. The call to allocate the
      netdev device is made from and managed by the peripherial.
      
      Fixes: f524f829
      
       ("can: m_can: Create a m_can platform framework")
      Reported-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
      Link: http://lore.kernel.org/r/20200227183829.21854-2-dmurphy@ti.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      85816aba
    • Dan Murphy's avatar
      can: m_can: m_can_class_free_dev(): introduce new function · a8c22f5b
      Dan Murphy authored
      This patch creates a common function that peripherials can call to free the
      netdev device when failures occur.
      
      Fixes: f524f829
      
       ("can: m_can: Create a m_can platform framework")
      Reported-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
      Link: http://lore.kernel.org/r/20200227183829.21854-2-dmurphy@ti.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      a8c22f5b
    • Wu Bo's avatar
      can: m_can: m_can_handle_state_change(): fix state change · cd0d83ea
      Wu Bo authored
      
      
      m_can_handle_state_change() is called with the new_state as an argument.
      
      In the switch statements for CAN_STATE_ERROR_ACTIVE, the comment and the
      following code indicate that a CAN_STATE_ERROR_WARNING is handled.
      
      This patch fixes this problem by changing the case to CAN_STATE_ERROR_WARNING.
      
      Signed-off-by: default avatarWu Bo <wubo.oduw@gmail.com>
      Link: http://lore.kernel.org/r/20200129022330.21248-2-wubo.oduw@gmail.com
      Cc: Dan Murphy <dmurphy@ti.com>
      Fixes: e0d1f481
      
       ("can: m_can: add Bosch M_CAN controller support")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      cd0d83ea
    • Marc Kleine-Budde's avatar
      can: tcan4x5x: tcan4x5x_can_remove(): fix order of deregistration · c81d0b6c
      Marc Kleine-Budde authored
      Change the order in tcan4x5x_can_remove() to be the exact inverse of
      tcan4x5x_can_probe(). First m_can_class_unregister(), then power down the
      device.
      
      Fixes: 5443c226
      
       ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
      Cc: Dan Murphy <dmurphy@ti.com>
      Link: http://lore.kernel.org/r/20201019154233.1262589-10-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      c81d0b6c
    • Marc Kleine-Budde's avatar
      can: tcan4x5x: tcan4x5x_can_probe(): add missing error checking for devm_regmap_init() · 1ff203ba
      Marc Kleine-Budde authored
      This patch adds the missing error checking when initializing the regmap
      interface fails.
      
      Fixes: 5443c226
      
       ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
      Cc: Dan Murphy <dmurphy@ti.com>
      Link: http://lore.kernel.org/r/20201019154233.1262589-7-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      1ff203ba
    • Enric Balletbo i Serra's avatar
      can: tcan4x5x: replace depends on REGMAP_SPI with depends on SPI · 3fcce133
      Enric Balletbo i Serra authored
      
      
      regmap is a library function that gets selected by drivers that need it. No
      driver modules should depend on it. Instead depends on SPI and select
      REGMAP_SPI. Depending on REGMAP_SPI makes this driver only build if another
      driver already selected REGMAP_SPI, as the symbol can't be selected through the
      menu kernel configuration.
      
      Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Link: http://lore.kernel.org/r/20200413141013.506613-1-enric.balletbo@collabora.com
      Reviewed-by: default avatarDan Murphy <dmurphy@ti.com>
      Fixes: 5443c226
      
       ("can: tcan4x5x: Add tcan4x5x driver to the kernel")
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      3fcce133
    • Zhang Qilong's avatar
      can: flexcan: fix failure handling of pm_runtime_get_sync() · b7ee5bc3
      Zhang Qilong authored
      pm_runtime_get_sync() will increment pm usage at first and it will resume the
      device later. If runtime of the device has error or device is in inaccessible
      state(or other error state), resume operation will fail. If we do not call put
      operation to decrease the reference, it will result in reference leak in the
      two functions flexcan_get_berr_counter() and flexcan_open().
      
      Moreover, this device cannot enter the idle state and always stay busy or other
      non-idle state later. So we should fix it through adding
      pm_runtime_put_noidle().
      
      Fixes: ca109896
      
       ("can: flexcan: implement can Runtime PM")
      Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
      Link: https://lore.kernel.org/r/20201108083000.2599705-1-zhangqilong3@huawei.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      b7ee5bc3
    • Marc Kleine-Budde's avatar
      can: flexcan: flexcan_setup_stop_mode(): add missing "req_bit" to stop mode property comment · 499aa923
      Marc Kleine-Budde authored
      In the patch
      
          d9b081e3 ("can: flexcan: remove ack_grp and ack_bit handling from driver")
      
      the unused ack_grp and ack_bit were removed from the driver. However in the
      comment, the "req_bit" was accidentally removed, too.
      
      This patch adds back the "req_bit" bit.
      
      Fixes: d9b081e3
      
       ("can: flexcan: remove ack_grp and ack_bit handling from driver")
      Reported-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: http://lore.kernel.org/r/20201014114810.2911135-1-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      499aa923
    • Colin Ian King's avatar
      can: peak_usb: fix potential integer overflow on shift of a int · 8a68cc0d
      Colin Ian King authored
      The left shift of int 32 bit integer constant 1 is evaluated using 32 bit
      arithmetic and then assigned to a signed 64 bit variable. In the case where
      time_ref->adapter->ts_used_bits is 32 or more this can lead to an oveflow.
      Avoid this by shifting using the BIT_ULL macro instead.
      
      Fixes: bb478555
      
       ("can: usb: PEAK-System Technik USB adapters driver core")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Link: https://lore.kernel.org/r/20201105112427.40688-1-colin.king@canonical.com
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      8a68cc0d
    • Marc Kleine-Budde's avatar
      can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb() · 81c9c8e0
      Marc Kleine-Budde authored
      The driver has to first fill the skb with data and then handle it to
      can_put_echo_skb(). This patch moves the can_put_echo_skb() down, right before
      sending the skb out via USB.
      
      Fixes: 51f3baad
      
       ("can: mcba_usb: Add support for Microchip CAN BUS Analyzer")
      Cc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>
      Link: https://lore.kernel.org/r/20201111221204.1639007-1-mkl@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      81c9c8e0