[PATCH v2 0/2] can: drop tx skb if the device is in listen only mode

Vincent Mailhol posted 2 patches 3 years, 12 months ago
drivers/net/can/dev/skb.c | 65 +++++++++++++++++++++++++++++++++++++++
include/linux/can/skb.h   | 59 +----------------------------------
2 files changed, 66 insertions(+), 58 deletions(-)
[PATCH v2 0/2] can: drop tx skb if the device is in listen only mode
Posted by Vincent Mailhol 3 years, 12 months ago
In listen only mode, tx CAN frames can still reach the driver if
injected via the packet socket. This series add a check toward
CAN_CTRLMODE_LISTENONLY in can_dropped_invalid_skb() to discard such
skb.

The first patch does some preparation work and migrates
can_dropped_invalid_skb() and can_skb_headroom_valid() from skb.h to
skb.c. This preparation is needed because skb.h does not include
linux/can/dev.h (for struct can_priv) and uapi/linux/can/netlink.h
(for the definition of CAN_CTRLMODE_LISTEONLY) which we need for this
change. The function being already big, better to de-inline them and
move them to a .c file.

The second and last patch is the actual change.


* Changelog *

v1 -> v2

  * move can_dropped_invalid_skb() to skb.c instead of dev.h

  * also move can_skb_headroom_valid() to skb.c

Vincent Mailhol (2):
  can: skb:: move can_dropped_invalid_skb and can_skb_headroom_valid to
    skb.c
  can: dev: drop tx skb if in listen only mode

 drivers/net/can/dev/skb.c | 65 +++++++++++++++++++++++++++++++++++++++
 include/linux/can/skb.h   | 59 +----------------------------------
 2 files changed, 66 insertions(+), 58 deletions(-)

-- 
2.35.1
Re: [PATCH v2 0/2] can: drop tx skb if the device is in listen only mode
Posted by Max Staudt 3 years, 12 months ago
From my view (I don't have the big picture here), this series looks good
to me. Thanks!


Max
Re: [PATCH v2 0/2] can: drop tx skb if the device is in listen only mode
Posted by Vincent MAILHOL 3 years, 12 months ago
On Sat. 14 May 2022 at 02:40, Max Staudt <max@enpas.org> wrote:
> From my view (I don't have the big picture here), this series looks good
> to me. Thanks!

Great! Can I add the tag below to the series?
Acked-by: Max Staudt <max@enpas.org>
(or any other based on your preference)

If this series gets pulled, you can remove the check from your driver.