Skip to content

Commit 6884d20

Browse files
WangX-1rodrigovivi
authored andcommitted
drm/xe/debugfs: fixed the return value of wedged_mode_set
It is generally expected that the write() function should return a positive value indicating the number of bytes written or a negative error code if an error occurs. Returning 0 is unusual and can lead to unexpected behavior. When the user program writes the same value to wedged_mode twice in a row, a lockup will occur, because the value expected to be returned by the write() function inside the program should be equal to the actual written value instead of 0. To reproduce the issue: echo 1 > /sys/kernel/debug/dri/0/wedged_mode echo 1 > /sys/kernel/debug/dri/0/wedged_mode <- lockup here Signed-off-by: Xin Wang <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Fei Yang <[email protected]> Cc: Shuicheng Lin <[email protected]> Reviewed-by: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent b31e668 commit 6884d20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/xe/xe_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static ssize_t wedged_mode_set(struct file *f, const char __user *ubuf,
167167
return -EINVAL;
168168

169169
if (xe->wedged.mode == wedged_mode)
170-
return 0;
170+
return size;
171171

172172
xe->wedged.mode = wedged_mode;
173173

0 commit comments

Comments
 (0)