Patch "mctp i3c: fix MCTP I3C driver multi-thread issue" 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

    mctp i3c: fix MCTP I3C driver multi-thread issue

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:
     mctp-i3c-fix-mctp-i3c-driver-multi-thread-issue.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 c02f8c26af718ca06db85126c7b2e14586622664
Author: Leo Yang <leo.yang.sy0@xxxxxxxxx>
Date:   Tue Jan 7 11:15:30 2025 +0800

    mctp i3c: fix MCTP I3C driver multi-thread issue
    
    [ Upstream commit 2d2d4f60ed266a8f340a721102d035252606980b ]
    
    We found a timeout problem with the pldm command on our system.  The
    reason is that the MCTP-I3C driver has a race condition when receiving
    multiple-packet messages in multi-thread, resulting in a wrong packet
    order problem.
    
    We identified this problem by adding a debug message to the
    mctp_i3c_read function.
    
    According to the MCTP spec, a multiple-packet message must be composed
    in sequence, and if there is a wrong sequence, the whole message will be
    discarded and wait for the next SOM.
    For example, SOM → Pkt Seq #2 → Pkt Seq #1 → Pkt Seq #3 → EOM.
    
    Therefore, we try to solve this problem by adding a mutex to the
    mctp_i3c_read function.  Before the modification, when a command
    requesting a multiple-packet message response is sent consecutively, an
    error usually occurs within 100 loops.  After the mutex, it can go
    through 40000 loops without any error, and it seems to run well.
    
    Fixes: c8755b29b58e ("mctp i3c: MCTP I3C driver")
    Signed-off-by: Leo Yang <Leo-Yang@xxxxxxxxxxxx>
    Link: https://patch.msgid.link/20250107031529.3296094-1-Leo-Yang@xxxxxxxxxxxx
    [pabeni@xxxxxxxxxx: dropped already answered question from changelog]
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
index 1bc87a062686..ee9d562f0817 100644
--- a/drivers/net/mctp/mctp-i3c.c
+++ b/drivers/net/mctp/mctp-i3c.c
@@ -125,6 +125,8 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)
 
 	xfer.data.in = skb_put(skb, mi->mrl);
 
+	/* Make sure netif_rx() is read in the same order as i3c. */
+	mutex_lock(&mi->lock);
 	rc = i3c_device_do_priv_xfers(mi->i3c, &xfer, 1);
 	if (rc < 0)
 		goto err;
@@ -166,8 +168,10 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)
 		stats->rx_dropped++;
 	}
 
+	mutex_unlock(&mi->lock);
 	return 0;
 err:
+	mutex_unlock(&mi->lock);
 	kfree_skb(skb);
 	return rc;
 }




[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