Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-08-01 Thread Krzysztof Kozlowski
2015-08-01 21:11 GMT+09:00 Jiri Kosina : > On Wed, 29 Jul 2015, Dmitry Torokhov wrote: > >> > Another and less intrusive fix would be: >> > >> > char *name = dev->battery->desc->name; >> > struct power_supply_desc *psy_desc = dev->battery->desc; >> >

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-08-01 Thread Jiri Kosina
On Wed, 29 Jul 2015, Dmitry Torokhov wrote: > > Another and less intrusive fix would be: > > > > char *name = dev->battery->desc->name; > > struct power_supply_desc *psy_desc = dev->battery->desc; > > power_supply_unregister(dev->battery); > > kfree(name); > >

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-08-01 Thread Jiri Kosina
On Wed, 29 Jul 2015, Dmitry Torokhov wrote: Another and less intrusive fix would be: char *name = dev-battery-desc-name; struct power_supply_desc *psy_desc = dev-battery-desc; power_supply_unregister(dev-battery); kfree(name); kfree(psy_desc); I would much

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-08-01 Thread Krzysztof Kozlowski
2015-08-01 21:11 GMT+09:00 Jiri Kosina jkos...@suse.com: On Wed, 29 Jul 2015, Dmitry Torokhov wrote: Another and less intrusive fix would be: char *name = dev-battery-desc-name; struct power_supply_desc *psy_desc = dev-battery-desc; power_supply_unregister(dev-battery);

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Dmitry Torokhov
On Thu, Jul 30, 2015 at 08:42:12AM +0900, Krzysztof Kozlowski wrote: > 2015-07-30 2:46 GMT+09:00 Dmitry Torokhov : > > On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote: > >> On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: > >> > >> > During unbinding the driver was dereferencing a

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Krzysztof Kozlowski
2015-07-30 2:46 GMT+09:00 Dmitry Torokhov : > On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote: >> On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: >> >> > During unbinding the driver was dereferencing a pointer to memory >> > already freed by power_supply_unregister(). >> > >> > Driver

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Dmitry Torokhov
On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote: > On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: > > > During unbinding the driver was dereferencing a pointer to memory > > already freed by power_supply_unregister(). > > > > Driver was freeing its internal description of battery

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Jiri Kosina
On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: > During unbinding the driver was dereferencing a pointer to memory > already freed by power_supply_unregister(). > > Driver was freeing its internal description of battery through pointers > stored in power_supply structure. However, because the

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Dmitry Torokhov
On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote: On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: During unbinding the driver was dereferencing a pointer to memory already freed by power_supply_unregister(). Driver was freeing its internal description of battery through

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Dmitry Torokhov
On Thu, Jul 30, 2015 at 08:42:12AM +0900, Krzysztof Kozlowski wrote: 2015-07-30 2:46 GMT+09:00 Dmitry Torokhov dmitry.torok...@gmail.com: On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote: On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: During unbinding the driver was

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Krzysztof Kozlowski
2015-07-30 2:46 GMT+09:00 Dmitry Torokhov dmitry.torok...@gmail.com: On Wed, Jul 29, 2015 at 03:07:04PM +0200, Jiri Kosina wrote: On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: During unbinding the driver was dereferencing a pointer to memory already freed by power_supply_unregister().

Re: [PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-29 Thread Jiri Kosina
On Tue, 28 Jul 2015, Krzysztof Kozlowski wrote: During unbinding the driver was dereferencing a pointer to memory already freed by power_supply_unregister(). Driver was freeing its internal description of battery through pointers stored in power_supply structure. However, because the core

[PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-27 Thread Krzysztof Kozlowski
During unbinding the driver was dereferencing a pointer to memory already freed by power_supply_unregister(). Driver was freeing its internal description of battery through pointers stored in power_supply structure. However, because the core owns the power supply instance, after calling

[PATCH] HID: hid-input: Fix accessing freed memory during driver unbind

2015-07-27 Thread Krzysztof Kozlowski
During unbinding the driver was dereferencing a pointer to memory already freed by power_supply_unregister(). Driver was freeing its internal description of battery through pointers stored in power_supply structure. However, because the core owns the power supply instance, after calling