Skip to content

Commit 36918e8

Browse files
NetanelBelgazalgregkh
authored andcommitted
net: ena: fix missing calls to READ_ONCE
[ Upstream commit 28abf4e ] Add READ_ONCE calls where necessary (for example when iterating over a memory field that gets updated by the hardware). Signed-off-by: Netanel Belgazal <netanel@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3e2cc5b commit 36918e8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/net/ethernet/amazon/ena/ena_com.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static void ena_com_handle_admin_completion(struct ena_com_admin_queue *admin_qu
457457
cqe = &admin_queue->cq.entries[head_masked];
458458

459459
/* Go over all the completions */
460-
while ((cqe->acq_common_descriptor.flags &
460+
while ((READ_ONCE(cqe->acq_common_descriptor.flags) &
461461
ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK) == phase) {
462462
/* Do not read the rest of the completion entry before the
463463
* phase bit was validated
@@ -633,7 +633,7 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
633633
writel(mmio_read_reg, ena_dev->reg_bar + ENA_REGS_MMIO_REG_READ_OFF);
634634

635635
for (i = 0; i < timeout; i++) {
636-
if (read_resp->req_id == mmio_read->seq_num)
636+
if (READ_ONCE(read_resp->req_id) == mmio_read->seq_num)
637637
break;
638638

639639
udelay(1);
@@ -1790,8 +1790,8 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data)
17901790
aenq_common = &aenq_e->aenq_common_desc;
17911791

17921792
/* Go over all the events */
1793-
while ((aenq_common->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) ==
1794-
phase) {
1793+
while ((READ_ONCE(aenq_common->flags) &
1794+
ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
17951795
pr_debug("AENQ! Group[%x] Syndrom[%x] timestamp: [%llus]\n",
17961796
aenq_common->group, aenq_common->syndrom,
17971797
(u64)aenq_common->timestamp_low +

0 commit comments

Comments
 (0)