driver core: fix race with userland in device_add()
authorSergey Klyaus <Sergey.Klyaus@tune-it.ru>
Wed, 8 Oct 2014 07:31:54 +0000 (11:31 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 19:14:57 +0000 (11:14 -0800)
commit0cd75047de7f54d6fb4aba0ec5818f8194815a5a
tree32fd93ff2934eef026907e747ee6fe6456785687
parent4ef67a8c95f32ed0c8c6ed5fe01d1dd16358350e
driver core: fix race with userland in device_add()

bus_add_device() should be called before devtmpfs_create_node(), so when
userland application opens device from devtmpfs, it wouldn't get ENODEV
from kernel, because device_add() wasn't completed.

Signed-off-by: Sergey Klyaus <Sergey.Klyaus@Tune-IT.Ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c