UPSTREAM: driver core: platform: fix race condition with driver_override

commit 6265539776a0810b7ce6398c27866ddb9c6bd154 upstream.

The driver_override implementation is susceptible to race condition when
different threads are reading vs storing a different driver override.
Add locking to avoid race condition.

Fixes: 3d713e0e382e ("driver core: platform: add device binding path 'driver_override'")
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Salido <salidoa@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

BUG=b:65880174
TEST=trybots

(cherry picked from commit c01ace719ebe6353f0c96e56f6c75c22ad3f67b0)
Signed-off-by: Aditya Kali <adityakali@google.com>

Change-Id: I20e76f432dfa8d6a178c2cf42721a5a0dfce3255
Reviewed-on: https://chromium-review.googlesource.com/677057
Reviewed-by: Daniel Wang <wonderfly@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: Aditya Kali <adityakali@google.com>
Commit-Queue: Aditya Kali <adityakali@google.com>
1 file changed