Patch "net: hns3: Resolved the issue that the debugfs query result is inconsistent." has been added to the 6.11-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

    net: hns3: Resolved the issue that the debugfs query result is inconsistent.

to the 6.11-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:
     net-hns3-resolved-the-issue-that-the-debugfs-query-r.patch
and it can be found in the queue-6.11 subdirectory.

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



commit 7e07122807d23ae2d5e974a19b84949540a37002
Author: Hao Lan <lanhao@xxxxxxxxxx>
Date:   Fri Oct 25 17:29:34 2024 +0800

    net: hns3: Resolved the issue that the debugfs query result is inconsistent.
    
    [ Upstream commit 2758f18a83ef283d50c0566d3f672621cc658a1a ]
    
    This patch modifies the implementation of debugfs:
    When the user process stops unexpectedly, not all data of the file system
    is read. In this case, the save_buf pointer is not released. When the user
    process is called next time, save_buf is used to copy the cached data
    to the user space. As a result, the queried data is inconsistent. To solve
    this problem, determine whether the function is invoked for the first time
    based on the value of *ppos. If *ppos is 0, obtain the actual data.
    
    Fixes: 5e69ea7ee2a6 ("net: hns3: refactor the debugfs process")
    Signed-off-by: Hao Lan <lanhao@xxxxxxxxxx>
    Signed-off-by: Guangwei Zhang <zhangwangwei6@xxxxxxxxxx>
    Signed-off-by: Jijie Shao <shaojijie@xxxxxxxxxx>
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index 807eb3bbb11c0..841e5af7b2bee 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -1293,8 +1293,10 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
 
 		/* save the buffer addr until the last read operation */
 		*save_buf = read_buf;
+	}
 
-		/* get data ready for the first time to read */
+	/* get data ready for the first time to read */
+	if (!*ppos) {
 		ret = hns3_dbg_read_cmd(dbg_data, hns3_dbg_cmd[index].cmd,
 					read_buf, hns3_dbg_cmd[index].buf_len);
 		if (ret)




[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