From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:54:58
Hello Jakub, hello David,
this is a pull request of 8 patches for net/master.
The first 3 patches are by Zhang Changzhong and fix 3 standard
conformance problems in the j1939 CAN stack.
The next patch is by Vincent Mailhol and fixes a memory leak in the
leak error path of the etas_es58x CAN driver.
Stephane Grosjean contributes 2 patches for the peak_usb driver to fix
the bus error handling and update the order of printed information
regarding firmware version and available updates.
The last 2 patches are by me and fixes a packet starvation problem in
the bus off case and the error handling in the mcp251xfd_chip_start()
function.
regards,
Marc
---
The following changes since commit 70bf363d7adb3a428773bc905011d0ff923ba747:
ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock() (2021-11-05 19:49:40 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-5.16-20211106
for you to fetch changes up to 69c55f6e7669d46bb40e41f6e2b218428178368a:
can: mcp251xfd: mcp251xfd_chip_start(): fix error handling for mcp251xfd_chip_rx_int_enable() (2021-11-06 21:25:25 +0100)
----------------------------------------------------------------
linux-can-fixes-for-5.16-20211106
----------------------------------------------------------------
Marc Kleine-Budde (2):
can: mcp251xfd: mcp251xfd_irq(): add missing can_rx_offload_threaded_irq_finish() in case of bus off
can: mcp251xfd: mcp251xfd_chip_start(): fix error handling for mcp251xfd_chip_rx_int_enable()
Stephane Grosjean (2):
can: peak_usb: always ask for BERR reporting for PCAN-USB devices
can: peak_usb: exchange the order of information messages
Vincent Mailhol (1):
can: etas_es58x: es58x_rx_err_msg(): fix memory leak in error path
Zhang Changzhong (3):
can: j1939: j1939_tp_cmd_recv(): ignore abort message in the BAM transport
can: j1939: j1939_can_recv(): ignore messages with invalid source address
can: j1939: j1939_tp_cmd_recv(): check the dst address of TP.CM_BAM
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 6 ++++--
drivers/net/can/usb/etas_es58x/es58x_core.c | 6 ++----
drivers/net/can/usb/peak_usb/pcan_usb.c | 27 +++++++++++++-------------
net/can/j1939/main.c | 7 +++++++
net/can/j1939/transport.c | 11 +++++++++++
5 files changed, 37 insertions(+), 20 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:55:03
From: Zhang Changzhong <redacted>
The TP.CM_BAM message must be sent to the global address [1], so add a
check to drop TP.CM_BAM sent to a non-global address.
Without this patch, the receiver will treat the following packets as
normal RTS/CTS transport:
18EC0102#20090002FF002301
18EB0102#0100000000000000
18EB0102#020000FFFFFFFFFF
[1] SAE-J1939-82 2015 A.3.3 Row 1.
Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Link: https://lore.kernel.org/all/1635431907-15617-4-git-send-email-zhangchangzhong@huawei.com
Cc: stable@vger.kernel.org
Signed-off-by: Zhang Changzhong <redacted>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/transport.c | 5 +++++
1 file changed, 5 insertions(+)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:55:03
From: Zhang Changzhong <redacted>
According to SAE-J1939-82 2015 (A.3.6 Row 2), a receiver should never
send TP.CM_CTS to the global address, so we can add a check in
j1939_can_recv() to drop messages with invalid source address.
Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Link: https://lore.kernel.org/all/1635431907-15617-3-git-send-email-zhangchangzhong@huawei.com
Cc: stable@vger.kernel.org
Signed-off-by: Zhang Changzhong <redacted>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/j1939/main.c | 7 +++++++
1 file changed, 7 insertions(+)
@@ -75,6 +75,13 @@ static void j1939_can_recv(struct sk_buff *iskb, void *data)skcb->addr.pgn=(cf->can_id>>8)&J1939_PGN_MAX;/* set default message type */skcb->addr.type=J1939_TP;++if(!j1939_address_is_valid(skcb->addr.sa)){+netdev_err_once(priv->ndev,"%s: sa is broadcast address, ignoring!\n",+__func__);+gotodone;+}+if(j1939_pgn_is_pdu1(skcb->addr.pgn)){/* Type 1: with destination address */skcb->addr.da=skcb->addr.pgn;
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:55:05
From: Stephane Grosjean <redacted>
Since for the PCAN-USB, the management of the transition to the
ERROR_WARNING or ERROR_PASSIVE state is done according to the error
counters, these must be requested unconditionally.
Link: https://lore.kernel.org/all/20211021081505.18223-2-s.grosjean@peak-system.com
Fixes: c11dcee75830 ("can: peak_usb: pcan_usb_decode_error(): upgrade handling of bus state changes")
Cc: stable@vger.kernel.org
Signed-off-by: Stephane Grosjean <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
@@ -841,14 +841,14 @@ static int pcan_usb_start(struct peak_usb_device *dev)pdev->bec.rxerr=0;pdev->bec.txerr=0;-/* be notified on error counter changes (if requested by user) */-if(dev->can.ctrlmode&CAN_CTRLMODE_BERR_REPORTING){-err=pcan_usb_set_err_frame(dev,PCAN_USB_BERR_MASK);-if(err)-netdev_warn(dev->netdev,-"Asking for BERR reporting error %u\n",-err);-}+/* always ask the device for BERR reporting, to be able to switch from+*WARNINGtoPASSIVEstate+*/+err=pcan_usb_set_err_frame(dev,PCAN_USB_BERR_MASK);+if(err)+netdev_warn(dev->netdev,+"Asking for BERR reporting error %u\n",+err);/* if revision greater than 3, can put silent mode on/off */if(dev->device_rev>3){
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:55:05
From: Vincent Mailhol <redacted>
In es58x_rx_err_msg(), if can->do_set_mode() fails, the function
directly returns without calling netif_rx(skb). This means that the
skb previously allocated by alloc_can_err_skb() is not freed. In other
terms, this is a memory leak.
This patch simply removes the return statement in the error branch and
let the function continue.
Issue was found with GCC -fanalyzer, please follow the link below for
details.
Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
Link: https://lore.kernel.org/all/20211026180740.1953265-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:55:08
The function can_rx_offload_threaded_irq_finish() is needed to trigger
the NAPI thread to deliver read CAN frames to the networking stack.
This patch adds the missing call to can_rx_offload_threaded_irq_finish()
in case of a bus off, before leaving the interrupt handler to avoid
packet starvation.
Link: https://lore.kernel.org/all/20211106201526.44292-1-mkl@pengutronix.de
Fixes: 30bfec4fec59 ("can: rx-offload: can_rx_offload_threaded_irq_finish(): add new function to be called from threaded interrupt")
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-11-06 21:55:09
From: Stephane Grosjean <redacted>
Proposes the possible update of the PCAN-USB firmware after indicating its
name and current version.
Link: https://lore.kernel.org/all/20211021081505.18223-3-s.grosjean@peak-system.com
Signed-off-by: Stephane Grosjean <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/peak_usb/pcan_usb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
@@ -883,6 +883,11 @@ static int pcan_usb_init(struct peak_usb_device *dev)returnerr;}+dev_info(dev->netdev->dev.parent,+"PEAK-System %s adapter hwrev %u serial %08X (%u channel)\n",+pcan_usb.name,dev->device_rev,serial_number,+pcan_usb.ctrl_count);+/* Since rev 4.1, PCAN-USB is able to make single-shot as well as*loopedbackframes.*/
Hello:
This pull request was applied to netdev/net.git (master)
by Marc Kleine-Budde [off-list ref]:
On Sat, 6 Nov 2021 22:54:41 +0100 you wrote:
Hello Jakub, hello David,
this is a pull request of 8 patches for net/master.
The first 3 patches are by Zhang Changzhong and fix 3 standard
conformance problems in the j1939 CAN stack.
[...]