Commit 372169fd authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge tag 'linux-can-fixes-for-7.0-20260409' of...

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

Marc Kleine-Budde says:

====================
pull-request: can 2026-04-09

Johan Hovold's patch fixes the a devres lifetime in the ucan driver.

The last patch is by Samuel Page and fixes a use-after-free in
raw_rcv() in the CAN_RAW protocol.

* tag 'linux-can-fixes-for-7.0-20260409' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
  can: raw: fix ro->uniq use-after-free in raw_rcv()
  can: ucan: fix devres lifetime
====================

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


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 65782b2d a535a921
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1397,7 +1397,7 @@ static int ucan_probe(struct usb_interface *intf,
	 */

	/* Prepare Memory for control transfers */
	ctl_msg_buffer = devm_kzalloc(&udev->dev,
	ctl_msg_buffer = devm_kzalloc(&intf->dev,
				      sizeof(union ucan_ctl_payload),
				      GFP_KERNEL);
	if (!ctl_msg_buffer) {
+10 −1
Original line number Diff line number Diff line
@@ -361,6 +361,14 @@ static int raw_notifier(struct notifier_block *nb, unsigned long msg,
	return NOTIFY_DONE;
}

static void raw_sock_destruct(struct sock *sk)
{
	struct raw_sock *ro = raw_sk(sk);

	free_percpu(ro->uniq);
	can_sock_destruct(sk);
}

static int raw_init(struct sock *sk)
{
	struct raw_sock *ro = raw_sk(sk);
@@ -387,6 +395,8 @@ static int raw_init(struct sock *sk)
	if (unlikely(!ro->uniq))
		return -ENOMEM;

	sk->sk_destruct = raw_sock_destruct;

	/* set notifier */
	spin_lock(&raw_notifier_lock);
	list_add_tail(&ro->notifier, &raw_notifier_list);
@@ -436,7 +446,6 @@ static int raw_release(struct socket *sock)
	ro->bound = 0;
	ro->dev = NULL;
	ro->count = 0;
	free_percpu(ro->uniq);

	sock_orphan(sk);
	sock->sk = NULL;