[PATCH v2 0/2] can: dev: make can_put_echo_skb() skb drops safe in any IRQ context

Cunhao Lu <[email protected]> Fri, 31 Jul 2026 16:23:52 +0800
Newsgroups org.kernel.vger.linux-can,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
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 <[email protected]>
---
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/[email protected]

To: Marc Kleine-Budde <[email protected]>
To: Vincent Mailhol <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
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 <[email protected]>