Patch "idpf: add read memory barrier when checking descriptor done bit" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    idpf: add read memory barrier when checking descriptor done bit

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     idpf-add-read-memory-barrier-when-checking-descripto.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d1c56c2e50fe8c3e82f4f887d7177dc0c363ac8d
Author: Emil Tantilov <emil.s.tantilov@xxxxxxxxx>
Date:   Thu Nov 21 20:40:59 2024 -0800

    idpf: add read memory barrier when checking descriptor done bit
    
    [ Upstream commit 396f0165672c6a74d7379027d344b83b5f05948c ]
    
    Add read memory barrier to ensure the order of operations when accessing
    control queue descriptors. Specifically, we want to avoid cases where loads
    can be reordered:
    
    1. Load #1 is dispatched to read descriptor flags.
    2. Load #2 is dispatched to read some other field from the descriptor.
    3. Load #2 completes, accessing memory/cache at a point in time when the DD
       flag is zero.
    4. NIC DMA overwrites the descriptor, now the DD flag is one.
    5. Any fields loaded before step 4 are now inconsistent with the actual
       descriptor state.
    
    Add read memory barrier between steps 1 and 2, so that load #2 is not
    executed until load #1 has completed.
    
    Fixes: 8077c727561a ("idpf: add controlq init and reset checks")
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
    Reviewed-by: Sridhar Samudrala <sridhar.samudrala@xxxxxxxxx>
    Suggested-by: Lance Richardson <rlance@xxxxxxxxxx>
    Signed-off-by: Emil Tantilov <emil.s.tantilov@xxxxxxxxx>
    Tested-by: Krishneil Singh <krishneil.k.singh@xxxxxxxxx>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/idpf/idpf_controlq.c b/drivers/net/ethernet/intel/idpf/idpf_controlq.c
index 4849590a5591f..b28991dd18703 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_controlq.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_controlq.c
@@ -376,6 +376,9 @@ int idpf_ctlq_clean_sq(struct idpf_ctlq_info *cq, u16 *clean_count,
 		if (!(le16_to_cpu(desc->flags) & IDPF_CTLQ_FLAG_DD))
 			break;
 
+		/* Ensure no other fields are read until DD flag is checked */
+		dma_rmb();
+
 		/* strip off FW internal code */
 		desc_err = le16_to_cpu(desc->ret_val) & 0xff;
 
@@ -563,6 +566,9 @@ int idpf_ctlq_recv(struct idpf_ctlq_info *cq, u16 *num_q_msg,
 		if (!(flags & IDPF_CTLQ_FLAG_DD))
 			break;
 
+		/* Ensure no other fields are read until DD flag is checked */
+		dma_rmb();
+
 		q_msg[i].vmvf_type = (flags &
 				      (IDPF_CTLQ_FLAG_FTYPE_VM |
 				       IDPF_CTLQ_FLAG_FTYPE_PF)) >>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux