]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ena: PHC: Add missing barrier
authorArthur Kiyanovski <akiyano@amazon.com>
Thu, 4 Jun 2026 08:07:04 +0000 (08:07 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Jun 2026 01:28:21 +0000 (18:28 -0700)
Add dma_rmb() barrier after req_id completion check in
ena_com_phc_get_timestamp(). On weakly-ordered architectures,
payload fields may be read before req_id is observed as updated.

Fixes: e0ea34158ee8 ("net: ena: Add PHC support in the ENA driver")
Closes: https://sashiko.dev/#/patchset/20260430032507.11586-1-akiyano%40amazon.com
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/amazon/ena/ena_com.c

index 8c86789d867a5f07bafd16a8528b8ad8c68783be..297fb36ab8c16f05eb3e9d9eb12c7b72cce769cb 100644 (file)
@@ -1880,6 +1880,11 @@ int ena_com_phc_get_timestamp(struct ena_com_dev *ena_dev, u64 *timestamp)
                        continue;
                }
 
+               /* Ensure PHC payload (timestamp, error_flags) is read
+                * after req_id update is observed
+                */
+               dma_rmb();
+
                /* req_id was updated by the device which indicates that
                 * PHC timestamp and error_flags are updated too,
                 * checking errors before retrieving timestamp