Counter fixes for 7.1

A fix to plug a refcount leak in counter_alloc() if dev_set_name() fails
 and the error path is taken.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCaga4SQAKCRC1SFbKvhIj
 K6BFAQCT+DwFTzJ8JVt4eXZIwzZ/B5KdTetOMVST6pjqwy9OiAEAhLhZeMFdkAxg
 KEUApW65KeKCSZKUEJeDftIOZxMx4ws=
 =28xw
 -----END PGP SIGNATURE-----

Merge tag 'counter-fixes-for-7.1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter into char-misc-linus

William writes:

Counter fixes for 7.1

A fix to plug a refcount leak in counter_alloc() if dev_set_name() fails
and the error path is taken.

* tag 'counter-fixes-for-7.1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
  counter: Fix refcount leak in counter_alloc() error path
This commit is contained in:
Greg Kroah-Hartman 2026-05-15 09:34:30 +02:00
commit b27bb2bf77

View File

@ -124,7 +124,8 @@ struct counter_device *counter_alloc(size_t sizeof_priv)
err_dev_set_name:
counter_chrdev_remove(counter);
put_device(dev);
return NULL;
err_chrdev_add:
ida_free(&counter_ida, dev->id);