Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609338
| From | Russell King - ARM Linux <linux@armlinux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() |
| Date | 2017-03-26 17:00 +0200 |
| Message-ID | <tphOa-1js-3@gated-at.bofh.it> (permalink) |
| References | <tphEt-1ge-5@gated-at.bofh.it> <tphEt-1ge-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Mar 26, 2017 at 10:41:50PM +0800, Leo Yan wrote: > Convert driver to use devm_*() APIs so rely on driver model core layer > to manage resources. This eliminates error path boilerplate and makes > code neat. > > This patch also fixes the memory leakage for 'kmi->io' when remove > module. No, it is not leaked, in fact, your patch introduces a use-after-free bug. kmi->io is of type "struct serio", and this structure has an embedded "struct device". The lifetime of any structure containing a "struct device" is controlled by the lifetime of the struct device. Once serio_register_port() has been called on it, it is up to the serio layer to free this structure. Therefore, your patch creates a bug, and so it gets a NAK. There is no resource leakage here. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/5] Input: ambakmi - Convert to use devm_*() Leo Yan <leo.yan@linaro.org> - 2017-03-26 16:50 +0200
Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-26 17:00 +0200
Re: [PATCH 1/5] Input: ambakmi - Convert to use devm_*() Leo Yan <leo.yan@linaro.org> - 2017-03-26 17:40 +0200
csiph-web