Skip to content

Commit 8e248f2

Browse files
committed
Merge tag 'linux-can-fixes-for-6.14-20250208' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2025-02-08 The first patch is by Reyders Morales and fixes a code example in the CAN ISO15765-2 documentation. The next patch is contributed by Alexander Hölzl and fixes sending of J1939 messages with zero data length. Fedor Pchelkin's patch for the ctucanfd driver adds a missing handling for an skb allocation error. Krzysztof Kozlowski contributes a patch for the c_can driver to fix unbalanced runtime PM disable in error path. The next patch is by Vincent Mailhol and fixes a NULL pointer dereference on udev->serial in the etas_es58x driver. The patch is by Robin van der Gracht and fixes the handling for an skb allocation error. * tag 'linux-can-fixes-for-6.14-20250208' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: rockchip: rkcanfd_handle_rx_fifo_overflow_int(): bail out if skb cannot be allocated can: etas_es58x: fix potential NULL pointer dereference on udev->serial can: c_can: fix unbalanced runtime PM disable in error path can: ctucanfd: handle skb allocation failure can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero Documentation/networking: fix basic node example document ISO 15765-2 ==================== Link: https://patch.msgid.link/20250208115120.237274-1-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 17847ea + f7f0adf commit 8e248f2

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

Documentation/networking/iso15765-2.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ to their default.
369369
370370
addr.can_family = AF_CAN;
371371
addr.can_ifindex = if_nametoindex("can0");
372-
addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG;
373-
addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG;
372+
addr.can_addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG;
373+
addr.can_addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG;
374374
375375
ret = bind(s, (struct sockaddr *)&addr, sizeof(addr));
376376
if (ret < 0)

drivers/net/can/c_can/c_can_platform.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,16 @@ static int c_can_plat_probe(struct platform_device *pdev)
385385
if (ret) {
386386
dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
387387
KBUILD_MODNAME, ret);
388-
goto exit_free_device;
388+
goto exit_pm_runtime;
389389
}
390390

391391
dev_info(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
392392
KBUILD_MODNAME, priv->base, dev->irq);
393393
return 0;
394394

395-
exit_free_device:
395+
exit_pm_runtime:
396396
pm_runtime_disable(priv->device);
397+
exit_free_device:
397398
free_c_can_dev(dev);
398399
exit:
399400
dev_err(&pdev->dev, "probe failed\n");

drivers/net/can/ctucanfd/ctucanfd_base.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,12 @@ static void ctucan_err_interrupt(struct net_device *ndev, u32 isr)
867867
}
868868
break;
869869
case CAN_STATE_ERROR_ACTIVE:
870-
cf->can_id |= CAN_ERR_CNT;
871-
cf->data[1] = CAN_ERR_CRTL_ACTIVE;
872-
cf->data[6] = bec.txerr;
873-
cf->data[7] = bec.rxerr;
870+
if (skb) {
871+
cf->can_id |= CAN_ERR_CNT;
872+
cf->data[1] = CAN_ERR_CRTL_ACTIVE;
873+
cf->data[6] = bec.txerr;
874+
cf->data[7] = bec.rxerr;
875+
}
874876
break;
875877
default:
876878
netdev_warn(ndev, "unhandled error state (%d:%s)!\n",

drivers/net/can/rockchip/rockchip_canfd-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ rkcanfd_handle_rx_fifo_overflow_int(struct rkcanfd_priv *priv)
622622
netdev_dbg(priv->ndev, "RX-FIFO overflow\n");
623623

624624
skb = rkcanfd_alloc_can_err_skb(priv, &cf, &timestamp);
625-
if (skb)
625+
if (!skb)
626626
return 0;
627627

628628
rkcanfd_get_berr_counter_corrected(priv, &bec);

drivers/net/can/usb/etas_es58x/es58x_devlink.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ static int es58x_devlink_info_get(struct devlink *devlink,
248248
return ret;
249249
}
250250

251-
return devlink_info_serial_number_put(req, es58x_dev->udev->serial);
251+
if (es58x_dev->udev->serial)
252+
ret = devlink_info_serial_number_put(req,
253+
es58x_dev->udev->serial);
254+
255+
return ret;
252256
}
253257

254258
const struct devlink_ops es58x_dl_ops = {

net/can/j1939/socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv, struct sock *sk,
11321132

11331133
todo_size = size;
11341134

1135-
while (todo_size) {
1135+
do {
11361136
struct j1939_sk_buff_cb *skcb;
11371137

11381138
segment_size = min_t(size_t, J1939_MAX_TP_PACKET_SIZE,
@@ -1177,7 +1177,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv, struct sock *sk,
11771177

11781178
todo_size -= segment_size;
11791179
session->total_queued_size += segment_size;
1180-
}
1180+
} while (todo_size);
11811181

11821182
switch (ret) {
11831183
case 0: /* OK */

net/can/j1939/transport.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,9 @@ sk_buff *j1939_session_skb_get_by_offset(struct j1939_session *session,
382382
skb_queue_walk(&session->skb_queue, do_skb) {
383383
do_skcb = j1939_skb_to_cb(do_skb);
384384

385-
if (offset_start >= do_skcb->offset &&
386-
offset_start < (do_skcb->offset + do_skb->len)) {
385+
if ((offset_start >= do_skcb->offset &&
386+
offset_start < (do_skcb->offset + do_skb->len)) ||
387+
(offset_start == 0 && do_skcb->offset == 0 && do_skb->len == 0)) {
387388
skb = do_skb;
388389
}
389390
}

0 commit comments

Comments
 (0)