Commit 851822ae authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge tag 'linux-can-fixes-for-6.19-20260115' of...

Merge tag 'linux-can-fixes-for-6.19-20260115' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2026-01-15

this is a pull request of 4 patches for net/main, it super-seeds the
"can 2026-01-14" pull request. The dev refcount leak in patch #3 is
fixed.

The first 3 patches are by Oliver Hartkopp and revert the approach to
instantly reject unsupported CAN frames introduced in
net-next-for-v6.19 and replace it by placing the needed data into the
CAN specific ml_priv.

The last patch is by Tetsuo Handa and fixes a J1939 refcount leak for
j1939_session in session deactivation upon receiving the second RTS.

linux-can-fixes-for-6.19-20260115

* tag 'linux-can-fixes-for-6.19-20260115' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
  net: can: j1939: j1939_xtp_rx_rts_session_active(): deactivate session upon receiving the second rts
  can: raw: instantly reject disabled CAN frames
  can: propagate CAN device capabilities via ml_priv
  Revert "can: raw: instantly reject unsupported CAN frames"
====================

Link: https://patch.msgid.link/20260115090603.1124860-1-mkl@pengutronix.de


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 5ce234a8 1809c82a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

menuconfig CAN_DEV
	bool "CAN Device Drivers"
	tristate "CAN Device Drivers"
	default y
	depends on CAN
	help
@@ -17,7 +17,10 @@ menuconfig CAN_DEV
	  virtual ones. If you own such devices or plan to use the virtual CAN
	  interfaces to develop applications, say Y here.

if CAN_DEV && CAN
	  To compile as a module, choose M here: the module will be called
	  can-dev.

if CAN_DEV

config CAN_VCAN
	tristate "Virtual Local CAN Interface (vcan)"
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ obj-$(CONFIG_CAN_VCAN) += vcan.o
obj-$(CONFIG_CAN_VXCAN)		+= vxcan.o
obj-$(CONFIG_CAN_SLCAN)		+= slcan/

obj-$(CONFIG_CAN_DEV)		+= dev/
obj-y				+= dev/
obj-y				+= esd/
obj-y				+= rcar/
obj-y				+= rockchip/
+3 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_CAN) += can-dev.o
obj-$(CONFIG_CAN_DEV) += can-dev.o

can-dev-y += skb.o

can-dev-$(CONFIG_CAN_DEV) += skb.o
can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.o
can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o
can-dev-$(CONFIG_CAN_NETLINK) += dev.o
+27 −0
Original line number Diff line number Diff line
@@ -375,6 +375,32 @@ void can_set_default_mtu(struct net_device *dev)
	}
}

void can_set_cap_info(struct net_device *dev)
{
	struct can_priv *priv = netdev_priv(dev);
	u32 can_cap;

	if (can_dev_in_xl_only_mode(priv)) {
		/* XL only mode => no CC/FD capability */
		can_cap = CAN_CAP_XL;
	} else {
		/* mixed mode => CC + FD/XL capability */
		can_cap = CAN_CAP_CC;

		if (priv->ctrlmode & CAN_CTRLMODE_FD)
			can_cap |= CAN_CAP_FD;

		if (priv->ctrlmode & CAN_CTRLMODE_XL)
			can_cap |= CAN_CAP_XL;
	}

	if (priv->ctrlmode & (CAN_CTRLMODE_LISTENONLY |
			      CAN_CTRLMODE_RESTRICTED))
		can_cap |= CAN_CAP_RO;

	can_set_cap(dev, can_cap);
}

/* helper to define static CAN controller features at device creation time */
int can_set_static_ctrlmode(struct net_device *dev, u32 static_mode)
{
@@ -390,6 +416,7 @@ int can_set_static_ctrlmode(struct net_device *dev, u32 static_mode)

	/* override MTU which was set by default in can_setup()? */
	can_set_default_mtu(dev);
	can_set_cap_info(dev);

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -377,6 +377,7 @@ static int can_ctrlmode_changelink(struct net_device *dev,
	}

	can_set_default_mtu(dev);
	can_set_cap_info(dev);

	return 0;
}
Loading