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]
Message-ID: <5538CB50.3010601@cogentembedded.com>
Date:	Thu, 23 Apr 2015 13:37:04 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Jia-Ju Bai <baijiaju1990@....com>
CC:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>, netdev@...r.kernel.org,
	David Miller <davem@...emloft.net>, stephen@...workplumber.org,
	Neil Horman <nhorman@...driver.com>
Subject: Re: Resource usages in Linux drivers

On 4/23/2015 1:08 PM, Jia-Ju Bai wrote:

>>>> I am very sorry to trouble you.

>>>> I find that resource management is error-prone when writing Linux drivers,
>>>> and
>>>> many problems may occur, such as resource leaks.
>>>> Meanwhile, I find that many applied patches in the kernel mailing list focus
>>>> on releasing allocated resources, especially in error-handling paths.

>>>> Therefore, I have a question: is it possible to automatically release
>>>> allocated resources in drivers before unloading and in error-handling paths?

>>>    Yes, there's managed device API, look for functions starting with devm_.
>>> There's one limitation though: it can be used only in the driver's probe()
>>> method, so can't be used when e.g. network device is being opened.

>> I think many APIs, such as kmalloc, can also be managed like garbage
>> collection in Java.
>> Maybe the performance is a matter.

>>>> I am looking forward to your reply, thanks!

>>>    Such questions should actually be asked on the mailing lists, not
>>> personally.

>> I am sorry for that, and I will cc to the mailing lists and other maintainers.

> I find that some common APIs are not managed, such as napi_enable and
> napi_start_queue. Is it possible to provide managed APIs for them?

    No, they're only called from ndo_open() method IIRC. The device managed 
APIs can only be called at the device probing time.

> I also find many drivers do not use these managed APIs, especially in ethernet
> card drivers (like e100, r8169). Is it possible to change them?

    Patches welcome. :-)

> Best wishes,
> Jia-Ju Bai

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ