Page MenuHomePhabricator

ecore-drm: Fix failure of setting/closing evdev->fd which causes fd leak
ClosedPublic

Authored by ohduna on Dec 10 2015, 1:14 AM.

Details

Summary

When a input device is plugged in, _cb_open_restricted() is called before creating evdev.
So setting fd value on evdev was failed in _cb_open_restricted() and also closing evdev->fd was invalid.
Using a eina_hash which has 'path-fd' pairs, we can find fd value after evdev is created.

Test Plan

(1) Multiple input devices are connected. Their evdev->fd remains zero or initial value.
(2) When one of those devices are plugged out, fd leak would happen.

Diff Detail

Repository
rEFL core/efl
Branch
work
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 792
Build 857: arc lint + arc unit
ohduna updated this revision to Diff 7784.Dec 10 2015, 1:14 AM
ohduna retitled this revision from to ecore-drm: Fix failure of setting/closing evdev->fd which causes fd leak.
ohduna updated this object.
ohduna edited the test plan for this revision. (Show Details)
ohduna added subscribers: input.hacker, Jeon.
devilhorns requested changes to this revision.Dec 10 2015, 6:05 AM
devilhorns edited edge metadata.
devilhorns added inline comments.
src/lib/ecore_drm/ecore_drm_inputs.c
23

I think this should be using intptr_t when adding to the hash because when we search the hash and assign it to edev, we are assigning it as intptr_t

This revision now requires changes to proceed.Dec 10 2015, 6:05 AM
ohduna updated this revision to Diff 7789.Dec 10 2015, 3:52 PM
ohduna edited edge metadata.

I revised according to devilhorns comment. Please review again. :)

ohduna updated this revision to Diff 7790.Dec 10 2015, 5:00 PM
ohduna edited edge metadata.

Updated again. :)

devilhorns accepted this revision.Dec 15 2015, 7:28 AM
devilhorns edited edge metadata.
This revision is now accepted and ready to land.Dec 15 2015, 7:28 AM
devilhorns closed this revision.Dec 15 2015, 7:28 AM