OSDN Git Service

greybus: svc: fix racy hotplug handling
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 2 Dec 2015 17:23:31 +0000 (18:23 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 3 Dec 2015 00:55:45 +0000 (16:55 -0800)
commit3e48acac26c8b5321ff5b752c8650e1cf4d04344
tree74ac46877e418e3eca54d9802cfe62db1ad52a71
parent57ccd4b08767bc3c44d3752bddcb6d6cad78830c
greybus: svc: fix racy hotplug handling

Fix racy hotplug handling by serialising all processing of hot-plug and
unplug requests using a single-threaded dedicated workqueue.

This fixes a reported crash during enumeration when processing multiple
events.

The current svc implementation does not handle concurrency at all (e.g.
no interface list lock or refcounting) so we need to use the big hammer
for now.

Note that we will eventually want to process events for different
interfaces in parallel, but that we'd still need a workqueue in order
not to starve other svc requests (e.g. for timesync).

Reported-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/svc.c
drivers/staging/greybus/svc.h