mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
linux-can-fixes-for-7.0-20260409
-----BEGIN PGP SIGNATURE----- iIkEABYKADEWIQSl+MghEFFAdY3pYJLMOmT6rpmt0gUCadfZ2RMcbWtsQHBlbmd1 dHJvbml4LmRlAAoJEMw6ZPquma3SgUkA/1a0V3slIJZKgZ+pCy9LtDmDJqkRcorz mGP3R9SrEG6AAQDcifMLxoYuG4zBlQksaOgCWrav0HjcB28EPTdFyiMvAw== =ZS47 -----END PGP SIGNATURE----- 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: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
372169fd95
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user