From 2b933918fcdbfb411502a9b12d77d6a1895855ce Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 13 Sep 2017 11:17:33 -0700 Subject: [PATCH] adb: add lock to remove_socket. The comment that was previously here says that local_socket_list_lock must be taken, but this function is exposed to external callers that can't possibly take the lock. Bug: http://b/65419665 Bug: 64709603 (presubmit balking at the line above) Test: python test_device.py Change-Id: I12d464933936b2a210a827ccf19ea201020d8d78 (cherry picked from commit 62c92f0c0529d8d1817afb4ff0c83151e4bb0ea0) --- adb/sockets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb/sockets.cpp b/adb/sockets.cpp index f28a3df50..c53fbb4ff 100644 --- a/adb/sockets.cpp +++ b/adb/sockets.cpp @@ -96,7 +96,7 @@ void install_local_socket(asocket* s) { } void remove_socket(asocket* s) { - // socket_list_lock should already be held + std::lock_guard lock(local_socket_list_lock); if (s->prev && s->next) { s->prev->next = s->next; s->next->prev = s->prev;