If there is a failure during copy_from_user, rtw_debugfs_set_fw_crash
should return negative error code instead of a positive value count.
Fix this bug by returning correct error code.
Signed-off-by: Zhang Shurong <[email protected]>
---
drivers/net/wireless/realtek/rtw88/debug.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index f9bcb44b42ac..700d5183d62a 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -955,7 +955,9 @@ static ssize_t rtw_debugfs_set_fw_crash(struct file *filp,
bool input;
int ret;
- rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
+ ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
+ if (ret < 0)
+ return ret;
ret = kstrtobool(tmp, &input);
if (ret)
--
2.40.0