greybus: interface: fix interface-registration race
authorJohan Hovold <johan@hovoldconsulting.com>
Mon, 7 Dec 2015 14:05:45 +0000 (15:05 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 8 Dec 2015 20:56:38 +0000 (15:56 -0500)
commitab66dd786b4b56875baabef7c188cff862231717
treef5bd9608de21ac18dac00d3a102ed8647df895ee
parent708d07a9ea2f32ee3cf4fcbbba8d52c42302b39b
greybus: interface: fix interface-registration race

Fix race with user space when registering the interface.

The interface was registered before having been fully initialised,
something which could lead to user space accessing not-yet-initialised
attribute values (e.g. zero vendor and product ids or empty vendor and
product strings).

Note that this is also needed to be able to let attribute visibility
depend on manifest data (e.g. interface unlock).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c