lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 14 Jul 2015 12:48:31 +0200
From:	Johannes Thumshirn <jthumshirn@...e.de>
To:	Sebastian Reichel <sre@...nel.org>
Cc:	Pali Rohár <pali.rohar@...il.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>,
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Tejun Heo <tj@...nel.org>,
	Johannes Thumshirn <jthumshirn@...e.de>
Subject: Re: [PATCH] power: Destroy IDRs on module exit

Sebastian Reichel <sre@...nel.org> writes:

> [+CC: Tejun Heo <tj@...nel.org>, for being very active in lib/idr.c]
>
> Hi,
>
> On Tue, Jul 14, 2015 at 11:16:14AM +0200, Johannes Thumshirn wrote:
>> Destroy IDRs on module exit, freeing the resources for
>> * bq2415x_charger.c
>> * ds2782_battery.c
>> * ltc2941-battery-gauge.c
>
> You missed bq27x00_battery.c. Maybe a coccinelle script should be
> written?

I already did this one that last week (I think), it should've been in
your INBOX (I hope).

>> The drivers had to be converted to "ordinary" module_init()/module_exit()
>> style drivers instead of using module_i2c_driver.
>
> mh I would prefer another solution. How about adding something
> like this:
>
> static void idr_remove_and_destroy(struct idr *idp, int id)
> {
>     idr_remove(idp, id);
>     if (idr_is_empty(idp)
>         idr_destroy(idp);
> }
>
> If that is called by the drivers instead of idr_remove(), there
> should be no need for adding idr_destroy to module_exit().
>

This would be an option.

[Copied a part of Palin's reply in here as well]
Palin> I'm feeling that there is something wrong with idr API. There is no idr
Palin> code in __init functions, so why it is needed for __exit? idr functions
Palin> are used in devices, not in global module.

but I start getting a bit puzzled about the whole IDR thing. Further
grepping through the tree revealed even more drivers doing
DEFINE_ID{A,R} but not all doing the destroy calls afterwards. Maybe
Tejun can clarify on this.

Johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ