Thread (6 messages) 6 messages, 3 authors, 2019-02-19

Re: [PATCH (resend)] Input: uinput - Set name/phys to NULL before kfree().

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2019-02-19 18:59:01
Also in: lkml

On Mon, Feb 18, 2019 at 07:10:23PM +0900, Tetsuo Handa wrote:
Thank you for responding.

On 2019/02/18 6:07, Dmitry Torokhov wrote:
quoted
The commit tries to send final uevent for objects for which "add" uevent
has been sent, but not "remove" event. However in uinput (and general
input case) we always take care of sending uevent at unregister, and do
not expect to have uevent sent out at the final "put" time.
Then, we want to keep dev->name and dev->phys when calling "unregister" time.
quoted
I believe the real fix is to have kobj->state_remove_uevent_sent be set
to true as soon as we enter kobject_uevent(kobj, KOBJ_REMOVE) so that
it is being set even if memory allocation fails. Doing anything else may
violate expectations of subsystem owning the kobject.
If we want to keep dev->name and dev->phys when calling "unregister" time,
we could do something like below. Does calling kobject_uevent(KOBJ_REMOVE)
without dev->name and dev->phys (to some degree) help (compared to not
triggering kobject_uevent(KOBJ_REMOVE) at all) ?
We are talking about handling pretty bad failure (I am not sure if these
allocations can fail in real life) so not getting KOBJ_REMOVE uevent is
not a big deal.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help