]> git.baikalelectronics.ru Git - kernel.git/commit
driver core: fix race between creating/querying glue dir and its cleanup
authorMing Lei <ming.lei@canonical.com>
Sun, 10 Jul 2016 11:27:36 +0000 (19:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Aug 2016 13:13:55 +0000 (15:13 +0200)
commitb76a4f94368e76673b84022b580d2d5039eab0ef
treeb4042d299494ce09ce38e37186191456fd0dfa2b
parentb4c2f518df2601add9c7031256d1d1b897690cb9
driver core: fix race between creating/querying glue dir and its cleanup

The global mutex of 'gdp_mutex' is used to serialize creating/querying
glue dir and its cleanup. Turns out it isn't a perfect way because
part(kobj_kset_leave()) of the actual cleanup action() is done inside
the release handler of the glue dir kobject. That means gdp_mutex has
to be held before releasing the last reference count of the glue dir
kobject.

This patch moves glue dir's cleanup after kobject_del() in device_del()
for avoiding the race.

Cc: Yijing Wang <wangyijing@huawei.com>
Reported-by: Chandra Sekhar Lingutla <clingutla@codeaurora.org>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c