]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerJiri Slaby <jslaby@suse.cz>
Thu, 15 Dec 2016 08:19:46 +0000 (09:19 +0100)
commita93a63333dbdb182b87e8cc99df8b4474f867acb
treef2ec8a3289ecc1a75eef86d4eb6e2a5be93454ce
parent5b46dc789ca2be4046e4e40a131858d386cac741
driver core: fix race between creating/querying glue dir and its cleanup

commit cebf8fd16900fdfd58c0028617944f808f97fe50 upstream.

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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/base/core.c