* [PATCH] cdc-acm: Destroy acm_minors IDR on module exit
@ 2015-07-08 15:25 Johannes Thumshirn
2015-07-09 8:57 ` Johan Hovold
2015-07-09 11:05 ` Oliver Neukum
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2015-07-08 15:25 UTC (permalink / raw
To: Oliver Neukum, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Johannes Thumshirn
Destroy acm_minors IDR on module exit, reclaiming the allocated memory.
This was detected by the following semantic patch (written by Luis Rodriguez
<mcgrof@suse.com>)
<SmPL>
@ defines_module_init @
declarer name module_init, module_exit;
declarer name DEFINE_IDR;
identifier init;
@@
module_init(init);
@ defines_module_exit @
identifier exit;
@@
module_exit(exit);
@ declares_idr depends on defines_module_init && defines_module_exit @
identifier idr;
@@
DEFINE_IDR(idr);
@ on_exit_calls_destroy depends on declares_idr && defines_module_exit @
identifier declares_idr.idr, defines_module_exit.exit;
@@
exit(void)
{
...
idr_destroy(&idr);
...
}
@ missing_module_idr_destroy depends on declares_idr && defines_module_exit && !on_exit_calls_destroy @
identifier declares_idr.idr, defines_module_exit.exit;
@@
exit(void)
{
...
+idr_destroy(&idr);
}
</SmPL>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/usb/class/cdc-acm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 519a77b..b30e742 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1944,6 +1944,7 @@ static void __exit acm_exit(void)
usb_deregister(&acm_driver);
tty_unregister_driver(acm_tty_driver);
put_tty_driver(acm_tty_driver);
+ idr_destroy(&acm_minors);
}
module_init(acm_init);
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cdc-acm: Destroy acm_minors IDR on module exit
2015-07-08 15:25 [PATCH] cdc-acm: Destroy acm_minors IDR on module exit Johannes Thumshirn
@ 2015-07-09 8:57 ` Johan Hovold
2015-07-09 11:05 ` Oliver Neukum
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2015-07-09 8:57 UTC (permalink / raw
To: Johannes Thumshirn
Cc: Oliver Neukum, Greg Kroah-Hartman, linux-usb, linux-kernel
On Wed, Jul 08, 2015 at 05:25:42PM +0200, Johannes Thumshirn wrote:
> Destroy acm_minors IDR on module exit, reclaiming the allocated memory.
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/usb/class/cdc-acm.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 519a77b..b30e742 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -1944,6 +1944,7 @@ static void __exit acm_exit(void)
> usb_deregister(&acm_driver);
> tty_unregister_driver(acm_tty_driver);
> put_tty_driver(acm_tty_driver);
> + idr_destroy(&acm_minors);
> }
>
> module_init(acm_init);
Acked-by: Johan Hovold <johan@kernel.org>
No stable-tag needed as idr wasn't used before 4.2.
Thanks,
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cdc-acm: Destroy acm_minors IDR on module exit
2015-07-08 15:25 [PATCH] cdc-acm: Destroy acm_minors IDR on module exit Johannes Thumshirn
2015-07-09 8:57 ` Johan Hovold
@ 2015-07-09 11:05 ` Oliver Neukum
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2015-07-09 11:05 UTC (permalink / raw
To: Johannes Thumshirn; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On Wed, 2015-07-08 at 17:25 +0200, Johannes Thumshirn wrote:
> Destroy acm_minors IDR on module exit, reclaiming the allocated
> memory.
>
> This was detected by the following semantic patch (written by Luis
> Rodriguez
> <mcgrof@suse.com>)
> <SmPL>
> @ defines_module_init @
> declarer name module_init, module_exit;
> declarer name DEFINE_IDR;
> identifier init;
> @@
>
> module_init(init);
>
> @ defines_module_exit @
> identifier exit;
> @@
>
> module_exit(exit);
>
> @ declares_idr depends on defines_module_init && defines_module_exit @
> identifier idr;
> @@
>
> DEFINE_IDR(idr);
>
> @ on_exit_calls_destroy depends on declares_idr && defines_module_exit
> @
> identifier declares_idr.idr, defines_module_exit.exit;
> @@
>
> exit(void)
> {
> ...
> idr_destroy(&idr);
> ...
> }
>
> @ missing_module_idr_destroy depends on declares_idr &&
> defines_module_exit && !on_exit_calls_destroy @
> identifier declares_idr.idr, defines_module_exit.exit;
> @@
>
> exit(void)
> {
> ...
> +idr_destroy(&idr);
> }
> </SmPL>
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Oliver Neukum <oneukum@suse.com>
--
Oliver Neukum <oneukum@suse.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-09 11:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 15:25 [PATCH] cdc-acm: Destroy acm_minors IDR on module exit Johannes Thumshirn
2015-07-09 8:57 ` Johan Hovold
2015-07-09 11:05 ` Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).