]> git.dujemihanovic.xyz Git - linux.git/commit
platform/chrome: cros_ec_proto: Lock device when updating MKBP version
authorPatryk Duda <patrykd@google.com>
Tue, 30 Jul 2024 10:44:25 +0000 (10:44 +0000)
committerTzung-Bi Shih <tzungbi@kernel.org>
Tue, 30 Jul 2024 11:48:35 +0000 (19:48 +0800)
commitdf615907f1bf907260af01ccb904d0e9304b5278
tree65004f50a72021a5cc46f554f14a46463117e844
parent4baf1cc54433ff7c6e5178517bc8768001416681
platform/chrome: cros_ec_proto: Lock device when updating MKBP version

The cros_ec_get_host_command_version_mask() function requires that the
caller must have ec_dev->lock mutex before calling it. This requirement
was not met and as a result it was possible that two commands were sent
to the device at the same time.

The problem was observed while using UART backend which doesn't use any
additional locks, unlike SPI backend which locks the controller until
response is received.

Fixes: f74c7557ed0d ("platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure")
Cc: stable@vger.kernel.org
Signed-off-by: Patryk Duda <patrykd@google.com>
Link: https://lore.kernel.org/r/20240730104425.607083-1-patrykd@google.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_proto.c