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)
committerHans de Goede <hdegoede@redhat.com>
Tue, 9 May 2023 09:54:35 +0000 (11:54 +0200)
commit3d43f9f639542fadfb28f40b509bf147a6624d48
tree2c6f87557b386d54a5458f9d0f18887718a2e782
parent4b65f95c87c35699bc6ad540d6b9dd7f950d0924
platform/mellanox: fix potential race in mlxbf-tmfifo driver

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>
drivers/platform/mellanox/mlxbf-tmfifo.c