[PATCH v2 0/2] can: dev: make can_put_echo_skb() skb drops safe in any IRQ context
From: Cunhao Lu
Date: Fri Jul 31 2026 - 04:27:49 EST
can_put_echo_skb() is a public helper used by CAN drivers. Its existing
skb drop paths use kfree_skb(), which is not suitable when the caller's IRQ
context is unknown.
Convert the existing drop paths to dev_kfree_skb_any(), then make the
invalid echo index path consume its skb with the same helper. This makes
the ownership semantics consistent across all error and drop paths.
Signed-off-by: Cunhao Lu <1579567540@xxxxxx>
---
Changes in v2:
- Add a preparatory patch replacing the existing kfree_skb() calls in
can_put_echo_skb() with dev_kfree_skb_any().
- Free the skb with dev_kfree_skb_any() on an invalid echo index.
- Collect Vincent's Reviewed-by tag for the binding patch
- Link to v1:
https://lore.kernel.org/linux-can/tencent_944DADCC4B42C8484EC01DA2B15F42132906@xxxxxx
To: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
To: Vincent Mailhol <mailhol@xxxxxxxxxx>
Cc: linux-can@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
Cunhao Lu (2):
can: dev: can_put_echo_skb(): use dev_kfree_skb_any()
can: dev: can_put_echo_skb(): free skb on invalid echo index
drivers/net/can/dev/skb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
base-commit: 11028ab62899e4191e074ee364c712b77823a9c4
change-id: 20260730-master-abf3e4067e47
Best regards,
--
Cunhao Lu <1579567540@xxxxxx>