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: [email protected]
Signed-off-by: Adrian Salido <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

BUG=b:65880174
TEST=trybots

(cherry picked from commit c01ace719ebe6353f0c96e56f6c75c22ad3f67b0)
Signed-off-by: Aditya Kali <[email protected]>

Change-Id: I20e76f432dfa8d6a178c2cf42721a5a0dfce3255
Reviewed-on: https://chromium-review.googlesource.com/677057
Reviewed-by: Daniel Wang <[email protected]>
Reviewed-by: Dmitry Torokhov <[email protected]>
Tested-by: Aditya Kali <[email protected]>
Commit-Queue: Aditya Kali <[email protected]>
1 file changed