[PATCH -next] drm/amdgpu: Fix missing unlock on error in amdgpu_ras_debugfs_table_read()

Chen, Guchun Guchun.Chen at amd.com
Tue Jul 6 02:04:46 UTC 2021


Thank you for the patch, Yingliang.

There is a similar patch sent out last Saturday and under review. Please check it.

[PATCH 3/4] drm/amdgpu: unlock on error in amdgpu_ras_debugfs


-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Yang Yingliang
Sent: Monday, July 5, 2021 9:40 AM
To: linux-kernel at vger.kernel.org; dri-devel at lists.freedesktop.org; amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: [PATCH -next] drm/amdgpu: Fix missing unlock on error in amdgpu_ras_debugfs_table_read()

Add the missing unlock before return from function
amdgpu_ras_debugfs_table_read() in the error handling case.

Fixes: 9b790694a031 ("drm/amdgpu: RAS EEPROM table is now in debugfs")
Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang at huawei.com>
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index fc70620369e4..dbeeb4986ca6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
@@ -912,8 +912,10 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf,
 			data_len = min_t(size_t, rec_hdr_fmt_size - r, size);
-			if (copy_to_user(buf, &data[r], data_len))
-				return -EINVAL;
+			if (copy_to_user(buf, &data[r], data_len)) {
+				res = -EINVAL;
+				goto Out;
+			}
 			buf += data_len;
 			size -= data_len;
 			*pos += data_len;

amd-gfx mailing list
amd-gfx at lists.freedesktop.org

More information about the amd-gfx mailing list