platform/mellanox: fix potential race in mlxbf-tmfifo driver
authorLiming Sun <limings@nvidia.com>
Wed, 26 Apr 2023 14:23:44 +0000 (10:23 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:34:08 +0000 (10:34 +0200)
commit61c3962ab1f9647998bab2aa47fb29bcc214d41a
tree9743dd4d00e1936339e55a938edd4a3194489499
parent809efd7a69a4c45af512038dadfa2e8603396cbe
platform/mellanox: fix potential race in mlxbf-tmfifo driver

[ Upstream commit 3d43f9f639542fadfb28f40b509bf147a6624d48 ]

This commit adds memory barrier for the 'vq' update in function
mlxbf_tmfifo_virtio_find_vqs() to avoid potential race due to
out-of-order memory write. It also adds barrier for the 'is_ready'
flag to make sure the initializations are visible before this flag
is checked.

Signed-off-by: Liming Sun <limings@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/b98c0ab61d644ba38fa9b3fd1607b138b0dd820b.1682518748.git.limings@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/mellanox/mlxbf-tmfifo.c