From patchwork Sat Apr 22 10:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676800 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57E84C6FD18 for ; Sat, 22 Apr 2023 10:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbjDVKLj (ORCPT ); Sat, 22 Apr 2023 06:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjDVKLh (ORCPT ); Sat, 22 Apr 2023 06:11:37 -0400 Received: from out203-205-221-247.mail.qq.com (out203-205-221-247.mail.qq.com [203.205.221.247]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0644D1719; Sat, 22 Apr 2023 03:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158293; bh=EQcI1oQzOcwyIUTiPaU4z5ZWBJcC45jiOUD5qZyZ8qQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZFKHFL0x2jt7a8fqABJRiRcZDSx2+zUCH3cVwk/nZK1TFhL1j22FeDLlYGBkB6Nox YHK0QjANRG2hehWxAR5NWL4bz4n5x5bwHdgN04KjpYNg25xR+F1EIWB1+cukr5pqKV dKlYn/s9ATTacozbqN9PA0qw71CC4zXZr36ptAK4= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157904txdh4nayd Message-ID: X-QQ-X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AuqtsDqgJH OotENqAvUX2EtlBOh2nOPdmllnx2Y= From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 01/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_write_reg Date: Sat, 22 Apr 2023 18:04:45 +0800 X-OQ-MSGID: <77cd82492eeb02a587a3da903a3824228ee21ab9.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user or user-provided data buffer is invalid, rtw_debugfs_set_write_reg should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Moreover, the check of buffer against null is removed since it will be handled by copy_from_user. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index fa3d73b333ba..bc41c5a7acaf 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -183,8 +183,8 @@ static int rtw_debugfs_copy_from_user(char tmp[], int size, tmp_len = (count > size - 1 ? size - 1 : count); - if (!buffer || copy_from_user(tmp, buffer, tmp_len)) - return count; + if (copy_from_user(tmp, buffer, tmp_len)) + return -EFAULT; tmp[tmp_len] = '\0'; @@ -338,14 +338,17 @@ static ssize_t rtw_debugfs_set_write_reg(struct file *filp, char tmp[32 + 1]; u32 addr, val, len; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + if (ret < 0) + return ret; /* write BB/MAC register */ num = sscanf(tmp, "%x %x %x", &addr, &val, &len); if (num != 3) - return count; + return -EINVAL; switch (len) { case 1: From patchwork Sat Apr 22 10:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C522C7EE21 for ; Sat, 22 Apr 2023 10:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229797AbjDVKLr (ORCPT ); Sat, 22 Apr 2023 06:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbjDVKLn (ORCPT ); Sat, 22 Apr 2023 06:11:43 -0400 Received: from out203-205-221-250.mail.qq.com (out203-205-221-250.mail.qq.com [203.205.221.250]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA7F1BFD; Sat, 22 Apr 2023 03:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158299; bh=+zF5ZlaKbkUYHZkMcIxweuJFjgybfbIGNceQyR/6yOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JqamWBG9qFXnGhfDexZn6fhgbtx8eB4mAhNiER0WfO1eS3o0zD7ry6lHbDmgbHcd0 AAPhAFf0syu0My3qXof4XFMoLGphWJwpWydWU+TlELWfBW4K6TDxZVQCFwgvxNl0R7 thql9OAw7rzNpZTsZe/RKFliPsTZT/mUv2R7Dqr0= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; S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U5zuqmtXh/+Oa/VWxekH0b4es3/PiDZW0iG5Ld0tsvhwv4bBL2CZFpmU M03t2kdeiuspZJZ2OPkk2fwXuKcKBvgxjPNn/ZqFInh0gIMDzb4oIjdJ0P3dA= From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 02/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_read_reg Date: Sat, 22 Apr 2023 18:04:46 +0800 X-OQ-MSGID: <502797e3be90fce642692156898586dc93e7755e.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user or user-provided data buffer is invalid, rtw_debugfs_set_read_reg should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index bc41c5a7acaf..3c3350bb2855 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -201,13 +201,16 @@ static ssize_t rtw_debugfs_set_read_reg(struct file *filp, char tmp[32 + 1]; u32 addr, len; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + if (ret < 0) + return ret; num = sscanf(tmp, "%x %x", &addr, &len); if (num != 2) - return count; + return -EINVAL; if (len != 1 && len != 2 && len != 4) { rtw_warn(rtwdev, "read reg setting wrong len\n"); From patchwork Sat Apr 22 10:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55720C7618E for ; Sat, 22 Apr 2023 10:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbjDVKLp (ORCPT ); Sat, 22 Apr 2023 06:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjDVKLn (ORCPT ); Sat, 22 Apr 2023 06:11:43 -0400 Received: from out203-205-251-88.mail.qq.com (out203-205-251-88.mail.qq.com [203.205.251.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1BA119AD; Sat, 22 Apr 2023 03:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158299; bh=8leUxeAPv62+4h4KjkbMWeydD4pGRjvCLJYv5hfyOdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LFNKt0TV3shD5sVqSFrZPSkx32eBER9jc5o65n+qPhkNsDV+VFsQ3EIm2nI6k4jj3 BokLxgbk1ygO4tJSD5n7VhDoa4bl/mMf/A6d06NQMthpy089yCbWrez6MoKpIwQFQf 38h7LKYpwfjzsoHAs0p3DyQ0T7KEHsA+WDqE6b14= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157919tv67qvjy7 Message-ID: X-QQ-XMAILINFO: N2tj+8mvLUD9Zr+YZf8MLVne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I0RS3nVr+6gyfkg== From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 03/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rsvd_page Date: Sat, 22 Apr 2023 18:04:47 +0800 X-OQ-MSGID: <38dcded193f4febdd0a7731229efe94e75d303ce.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user, rtw_debugfs_set_rsvd_page should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index 3c3350bb2855..d8e872ae4dda 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -291,8 +291,11 @@ static ssize_t rtw_debugfs_set_rsvd_page(struct file *filp, char tmp[32 + 1]; u32 offset, page_num; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + if (ret < 0) + return ret; num = sscanf(tmp, "%d %d", &offset, &page_num); From patchwork Sat Apr 22 10:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BD01C77B78 for ; Sat, 22 Apr 2023 10:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbjDVKLl (ORCPT ); Sat, 22 Apr 2023 06:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbjDVKLj (ORCPT ); Sat, 22 Apr 2023 06:11:39 -0400 X-Greylist: delayed 380 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 22 Apr 2023 03:11:37 PDT Received: from out203-205-251-88.mail.qq.com (out203-205-251-88.mail.qq.com [203.205.251.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8277E1729; Sat, 22 Apr 2023 03:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158295; bh=XE+xW4zcJKwa46DVTbWJWKZcEJQ/Q3+YX0ZLl0C0gvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KaEvBaLQvIkgQVKMWMyZZG98KAUvh8BEuHoQdRZH13v+SqlJhVzBITnKTfUJHs0qs ehc4Ro9CxMhHkG3JshAChRCSfqOrHrrlXtYhqEwyZdRrsbbY1QophbfNh4oyE+tz+D ZKGjX3EC95ceolg11b4vSnPdpEtP6DN/K7EdxjDo= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157923tnl23habh Message-ID: X-QQ-XMAILINFO: MxcclqldyJbqxsleZ8/LdlokQ5tJqfinINGxg8sGGglaHQpKf+07EBR5uVeGzg ZtCrhYt7Q8zCgBKC0YPbuwbqoVYBgiY0e6zWMXbuCxpxwImp8iExx6jKA66qPkNxcaJVf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ft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 04/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_single_input Date: Sat, 22 Apr 2023 18:04:48 +0800 X-OQ-MSGID: <5c743fefab84f1d490a73c61fe0a3cb0310a5677.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user, rtw_debugfs_set_single_input should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index d8e872ae4dda..f721205185cf 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -320,8 +320,11 @@ static ssize_t rtw_debugfs_set_single_input(struct file *filp, char tmp[32 + 1]; u32 input; int num; + 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; num = kstrtoint(tmp, 0, &input); From patchwork Sat Apr 22 10:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DA60C7618E for ; Sat, 22 Apr 2023 10:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229898AbjDVKMh (ORCPT ); Sat, 22 Apr 2023 06:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjDVKMM (ORCPT ); Sat, 22 Apr 2023 06:12:12 -0400 Received: from out203-205-221-249.mail.qq.com (out203-205-221-249.mail.qq.com [203.205.221.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19AA271C; Sat, 22 Apr 2023 03:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158308; bh=AiHaweSI9v1B2EKsrPZKFyxUxyDMJ+lDNtxzoXG3z3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q8sl5ZZPJOS+KLV3bMXaR0lxI1BGXiSd6vwlYmevTTHOOwNxer6PH5lPDSOoKaVcL u+xQ+hsHj5L92Srh96a+OzHBUyqL0fpiOcN91rcs4UxGhv8EONjJK7SnxAHOK4dv8G k3DfmpYWEFSrix2nQDqeH054dk8UFcKoXH4VBmUE= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157926th7ubsyc9 Message-ID: X-QQ-XMAILINFO: OUycJhUUya+/p9YnDt4faZAK2QKOb4v+LDStxlHMcQvroFSprUYeyZVfVKi/bd C9bgOAwgE3UGY1RYgsa9yHqX6S82AN6q9JSVnJJuoMdCGLkFUnNpEB+Q1wrdZruvy+s+aphs+QZ0 Np/x8sPaW9yo5DX4TMa3Hm/yAIYhsyQUx34C04PqUIHrp9MckNkeUhWGLT0rtGWnRei559pefsdM 6ULaQkcoaB46kHR+ClBMO9ol6T6zJu1W9/go9JfASKkyKfVHkAHcuRcvDtQrkrQ837EOOYaQwUI9 ZzEterk4XGbSeiuHm5c+Eb3gmoqClDZxocN6C81E7o4PyuPkLm2BL4SzKBXQ96z9fFAtTZL9BlUI dvPHC3NW0yGnfbxokZEeV+I+FEvHpLBmtXLsjFzkXQjURoTFTjTzi//A6WqXQVg49xV7MM04MH69 q2VetfKaScahmX73YcpSD1LQFBu7yrdlvPsrcq0fdEKxzPgrWMioddzaIWHEDu7ZgL6THVl7zgG7 HQORpAZoX5hipnCnRw9mGJ03Ry94fHGEbEAH7ULvIMU1wZ5b9AXKS/VzOrpDWjvoGiFCdymZU9Ry kg3MIIUTAHZho5HaiYxVFTbYZaMwHTypH0kY8sHrkDPf+9Ltsf3U7mQxmWyrVYfgiIXCKPNWfmAS HwsGZfuulSc1bbZSrUo7AkYbEEkuYmeihEcpPmyC7hpxYsXGTCtNfJUiScLM/Y/1U+jmFsZkPJQx fork2jgxmTIqNAFHdFPKb7foUJwrxFd9r9V+DTynsRIJ0ipjzG5mJfcikQqu6uS32JhmctQQlCuA c9Ju8ndXDhwGbl9XV5qIuAUNSqeX2XgmAxj3bAKhVxSCkE9uGi4JJr13gHE/rD9Q25ugUXnEXtGv pHpt9+uCBMY0w4b07jlOZdwMu5A8Ea+uWsMwTmedIxOJ3V0hmIN5C52pbDF73DIw89qCYSTgxnjT FJf4q5PkjTRNTom/5s5R+d5Fr0e+merkgS+Frj5VacKPBQVBudwreBIPPRdog+6t/h5RLwICDXmV SEUDmm2dipcuRLWGiOTFex4HUAJaHBYOE1L+JCzo8yhFIZHaVf From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 05/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_h2c Date: Sat, 22 Apr 2023 18:04:49 +0800 X-OQ-MSGID: <71d87586fb8e306ea9ed5ccde7e5a98be52e4c0c.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user, rtw_debugfs_set_h2c should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index f721205185cf..911f0514c497 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -393,8 +393,11 @@ static ssize_t rtw_debugfs_set_h2c(struct file *filp, char tmp[32 + 1]; u8 param[8]; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + if (ret < 0) + return ret; num = sscanf(tmp, "%hhx,%hhx,%hhx,%hhx,%hhx,%hhx,%hhx,%hhx", ¶m[0], ¶m[1], ¶m[2], ¶m[3], From patchwork Sat Apr 22 10:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8ADEC6FD18 for ; Sat, 22 Apr 2023 10:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbjDVKTa (ORCPT ); Sat, 22 Apr 2023 06:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbjDVKTV (ORCPT ); Sat, 22 Apr 2023 06:19:21 -0400 Received: from out203-205-221-249.mail.qq.com (out203-205-221-249.mail.qq.com [203.205.221.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37FEA1FC0; Sat, 22 Apr 2023 03:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158739; bh=z8S0DFiFjCmjZMlMnT7AsuASmakTQv+zP2mNvAbhkDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DQDIlvGj+k291zGMDr/BTa6A+qH4C6wKfS4EkpINPNVquKfvHMdMuMg5t18SWdnpN HWb/J87/+ObFVhO9dGlfNK7W1kYswTHn6iQtnlgzMzBICGNfGCpXWOqLbFlPqG+EoI sY+cRI3PLhH39ELnm6X22MxSgSmyntEjE3G8oQAc= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157928tfv627lfy Message-ID: X-QQ-XMAILINFO: MpSLeT6aCErC+jUWDBvMxzccUdI/jjD4NwtJ4TEOo9iC1GERxc1SIoBgPLOzb1 eYZVK8tjnJcAtnFGp+jh71Ub6LDEAue2FU69fnC1yHEnSiPkV3diI4bgrnAW00snShYC3ahuBegP Jgd8avl24nIYPPpMNYy5c/Tys0+qNAUdnNKZXRD69IBfbH8DQnUeHu43m3gH5/mPNwoZkXB75b/H bL1d0gL4lbXbKvqiGBF+lZNL77hsk35BAJsNHdMbcwK7E5T7XHt+W4vuLQaMEZaWQjZ1S/22iGpe ocX5Qvyfi3sf9EA3KbljpcgTxn3MOLx4trU+urrlivq+8tyzQO5j+hNKpFp4m9vdEckHLIoGtUH6 679lUgq7gs1c43NVoI7jE+34yvtiDZLK0zNO7mWXC/GVTjV9czGM8sQWutr9M5YAzYCxCjcoB+ze 78zIrhj7mzNsgTx2OXOuFDOJLX8V1KC6nUu/mVsAu2B+HglqwpXTr38NNbAxgyRYS+L1yprfb/IR 3NzkP4JWOgVkbuxLjebKItwbRMuerQz3WtIUJYMrtpGRNYSiAwnail9afXkss4H+UC7amCod4Y0C 60waM7134L98FOzSL6TH5t8QiqcbDUzhac6xo0ApMNCpref6AF/4K/9Q2AnGty7n//hszOpCDFfY ma1Gg9hp9WPMV0KwdAcXXi61qc3QOldIdDk9+LtzvdYdnTdgDReDQHG3Dgu1DkSp5SKN64VYQsOv KJJrbodvI8O9Jf7s+sy7NeXv4LdTiypYuLDaPUXpspknbuB3i4eIiyyvci2pgHBQbxMXm3K+2Aa0 eRIiDhz/K+FFN3zj3zJ3bUwmIuSjX44SK1BMDZjaWgcwqwJTaj7A/UnwL2a9SFkyt/99HwRFdLua SKzMLzwlgdBnWpRcLq7EjqGPwF5ovi2fR74fnXsTflEpKPekaK9ZveoMxYX5NvsWrMlZup6lVtjQ uBoyLBCA0gL+dQl6lL3gN+Vmt64E1mnX/J7lVZzjMSZuD+LymUR8AsW9ECDyYguoT6FU1hUUYTj5 9q6a5Gylu/qxrlh76haqSaEfyt1jGiCNJRWJBI2w== From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 06/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rf_write Date: Sat, 22 Apr 2023 18:04:50 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user or user-provided data buffer is invalid, rtw_debugfs_set_rf_write should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index 911f0514c497..259e6c15bc78 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -423,14 +423,17 @@ static ssize_t rtw_debugfs_set_rf_write(struct file *filp, char tmp[32 + 1]; u32 path, addr, mask, val; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 4); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 4); + if (ret < 0) + return ret; num = sscanf(tmp, "%x %x %x %x", &path, &addr, &mask, &val); if (num != 4) { rtw_warn(rtwdev, "invalid args, [path] [addr] [mask] [val]\n"); - return count; + return -EINVAL; } mutex_lock(&rtwdev->mutex); From patchwork Sat Apr 22 10:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E52EC7618E for ; Sat, 22 Apr 2023 10:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjDVKMT (ORCPT ); Sat, 22 Apr 2023 06:12:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229835AbjDVKMH (ORCPT ); Sat, 22 Apr 2023 06:12:07 -0400 Received: from out203-205-251-88.mail.qq.com (out203-205-251-88.mail.qq.com [203.205.251.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5CE91FCE; Sat, 22 Apr 2023 03:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158307; bh=UnrqfxT/+f0yl1p9/78VwA5lXrGvNaLj9i7u4tCZz+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JIu8f4DOmrPVFwOM4tx2J0+80lU0Y5cdbAzd+6IpTFvYW3J1DIwRWj2LAGHBUchi/ kJGEBA2CAhvGzuKm2ZpMB7a2XMrhoyzcErc9dS9jyjS5lvQYJWC4YIwDibxkIWNwLK Y3ulMMWxgwPPxSxEDx417DNAlyKIF4uZGQSTmHOA= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157930tdj6u3chr Message-ID: X-QQ-XMAILINFO: OYKvv92VoppH1v1SwCCPgzeLXkAzqSlswXWrMCRw5pizllEsRyzjCMDwd5BBtC z3+vNYVqQotAg4iS1/sWFP70rLO6MlJb0GZxBEq4OMX8Uvd8pCkWkIMx2KzsspMHMjZduN4Kfzwv 2lRsydsI1E6P2fpOI3UTiDEqScB0orELn/t7qD93xwEXXkjnTA6hrz4ktGXdUBBTekw0ITVl6cQT kPMO7cHuRIZcxJtqaeFbbDXnz3ZeS6BaEPXA6idPTmsMNdzbpyVMjkVbz8/UYm8HWgU9O+vQbA/Y tLJNAy2ZpbeRakK0e9iMHS9UDGtu345eFhcqfPwbT12lsbjZdlhR8JSe0xo7bOaanitwsQw5Z+g2 Rf4sEG1WyqgBPuUgYXCwqTwLOtiQk54i53QuenhJPXdjmYR+BieoiYaa5J2sU+C8f3lO/7X1m5DO JffX4AOpD9nBuDA7duQowrYmrdp1iPJZ3e6RUMPh3NRO8DgkIrX1JUNE7aYmW8pepbD8r1RpH4Po Z8GYS+8YWIlufbGfnogrNb34+XITKI4GWhm05QFzFXEkjGzLm/rGGQ+cvAdrukwu8UP38/2yS/RD 0fIVwiCY1Xi8Cp0LQMigPzCWEY5T5yA/GXArbjr4Zgc6F1ffCtLdsFltWz0Xn4wZdRgwATSP+Xxu 5xfRt6SMOT3Y7d+bLY++vaQaPNXLVnTnsoJo/usQwrD7xwbxVO9C/HVnAy7sQvjbO7Lu8aDJkP73 lmF9ANmomkQxLHpo2JUDHqAESJbF+EARdfY7abXEHawQFPEUxPA/9DBJtrsFCOXD+Esi1f/8yX51 TjOKv1ZnpBNj1UZhWW7bRx855EV5n+sBQQAYJRMZrSkhjEqO+dQZPpMh9xTTUzpaHc4tX4xbv7qa 1I60t8TrdeU0LGTRJCmfGhI10/nLh6alMHQVRebs09oGYPaDlGye+27xumZsjCOw32E2c8UHkuxb lOtf34UJWsbyBsaRYxbhNgAwtn7MVIjBtcmhAt/+gl31hJZZCTdVewX5leZYM9ZD+901KmgXPeFp tjr0G2OgNsmdzQh3m3Z28sInM22hglVQcfqO70GT+ixiETI9qgD/tdXnySK50V5bhycPy49g== From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 07/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rf_read Date: Sat, 22 Apr 2023 18:04:51 +0800 X-OQ-MSGID: <69640619f8704e67059944eb29332a0a1d2d3d6e.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user or user-provided data buffer is invalid, rtw_debugfs_set_rf_read should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- drivers/net/wireless/realtek/rtw88/debug.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index 259e6c15bc78..e033077d49b0 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -456,14 +456,17 @@ static ssize_t rtw_debugfs_set_rf_read(struct file *filp, char tmp[32 + 1]; u32 path, addr, mask; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + if (ret < 0) + return ret; num = sscanf(tmp, "%x %x %x", &path, &addr, &mask); if (num != 3) { rtw_warn(rtwdev, "invalid args, [path] [addr] [mask] [val]\n"); - return count; + return -EINVAL; } debugfs_priv->rf_path = path; From patchwork Sat Apr 22 10:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11607C6FD18 for ; Sat, 22 Apr 2023 10:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbjDVKGa (ORCPT ); Sat, 22 Apr 2023 06:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjDVKG3 (ORCPT ); Sat, 22 Apr 2023 06:06:29 -0400 X-Greylist: delayed 79 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 22 Apr 2023 03:06:25 PDT Received: from out203-205-221-250.mail.qq.com (out203-205-221-250.mail.qq.com [203.205.221.250]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACECC1BC3; Sat, 22 Apr 2023 03:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682157983; bh=ZVHvqzotBOxirfSKO82CUWP0DLUkcEMYWq+fWqQiZB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SuY4vanW9TbMyICI++qkAq6DzG3fF22ubN9xzEUm1B+uQ9Tex/TfLLJCeO/Jr7PYp ykj4f7ivsWN+RXLVUS6ZT187BiHGuSdzjs2UOoHSyhWgTtQRC1w4I6BRuZJ/6FcHUE Hggdo8xMtBe++HpC6NiniuKW4uSSXhKZapkuzjDw= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157933to0osbp60 Message-ID: X-QQ-XMAILINFO: MD2XmhJtctJJ3gS85vJgQKMDe6cZJ7mql9xOyhdCfdIqT6eFBmkvs5RW94dkFK +7WiWR3W2UG72X+SfWM0JnXjwhEq9AH3ndDivFvSecOOXaXSctjXq2k8URPLYRQvPnBoc5kHJk4a eTxwAflOj+7X25ENUnTDYBRmiw25DiqJOZ5G1AHi0Ohcz7lOW/KiOLB03dhYKunY2qEkE49OaZTQ 3caNJ6vT5tod7wRi0+8mHt4JIfAa4fXaVp8kArPfsq6oGbSPqaeIorZ/O0Ua2zmEqVNAqIY+kB38 gbqIFO9uaS0LHzT+JopdDm8Fd+86dnhD3Vo3Sz3Cakl+bNu6WB8k8GOWusp+Ml7FWGM6JPq8Ti41 TJ2iZxGYqSjF0vrBZwrqY3nCso00B+vBfkD3T0mWrsR0eVwQBZB6KECx7Adn9OnIP4vAAYxI84qE YgIRu99UoJSFjSa2kfosHM62WnJ0capbpzZvaITKypwh/vCT0C2HXgK2k6XyPpbU9heSB+p/h9XT eX2OKgt1kngaxz5aidD8P7HaTmb2IUWaUc8Y6W02fOtIK48KpxcNJ0UseLIqpAAP/KUp6k/MD1cC R2QtGWDaQpeVSncWb/I6bPpVpLuOAA2Cq/f7DylFTSzPM/gRpwuXMXaTYvMSMlupUW7ewC4qckv+ RTevKmnj/RNJpY8FwKLm4qGDf2bSKRzgQA3Xn1fuCJE8NM2dMFYuan1LojQw72m2HMTdZVNNYKbk VUyv0OJw0DX8gt3tn9e7kGCEeLugA51vIvLdmtjqo5XTKNP5kKbSizzt2dWB1g+6BDEdNfg4tCgl AzGMkTQA/IjBu0tGZWn9kgP/JNMI+oaS9mPJg8V3HUeUnpxDST+v5q9Q1xRObbXzzkEPIYWkH+m6 hc1qYOXbx7Tk86s9tcRMnXHMS+CmmTk3DFfZ6S/noMm+VDEBgPwWirJpRL1GMNmPgiDcmFtL/4cB zthBXknJiXBjM+Zgmxrq5Z8ZUgiBps9rYQX3TB0tGd/cE9Oinbzq6kJVL6O/3m4ZxqWYKrOoNRT5 ceOly5i1lqXNEyQ1QIEaNuLJaJTg3NDZb143+UfKltabY9QNom From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 08/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_fix_rate Date: Sat, 22 Apr 2023 18:04:52 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user, rtw_debugfs_set_fix_rate should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- 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 e033077d49b0..aef43f3ca364 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -488,7 +488,9 @@ static ssize_t rtw_debugfs_set_fix_rate(struct file *filp, char tmp[32 + 1]; 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 = kstrtou8(tmp, 0, &fix_rate); if (ret) { From patchwork Sat Apr 22 10:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3622DC6FD18 for ; Sat, 22 Apr 2023 10:07:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjDVKHK (ORCPT ); Sat, 22 Apr 2023 06:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjDVKHJ (ORCPT ); Sat, 22 Apr 2023 06:07:09 -0400 Received: from out203-205-221-249.mail.qq.com (out203-205-221-249.mail.qq.com [203.205.221.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D721BCD; Sat, 22 Apr 2023 03:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158025; bh=SnfImROfHHS8oLIFhAcHzEgotoQ5IZ5awfUwJVXBhm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WmKYODdefrAXogqZ2E1TDxf8x+7ivr587ESi2J6qIzBaW2XNpZy0ADm1lpX2t3cYK Q3Q7WqNebdfuDc+I6z9wNN1xRcYuO+dAR37eDX5j4QKpmJNvzWrlzYbImfsOIoH5aE Fei4Fl9EUx6BnDHNdwHnRP5Sv90sh7HzDbACrx3k= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157935tafy4oywe Message-ID: X-QQ-XMAILINFO: N346zIWbcZWrh6GwbAB/RhXbRnBNeGy8D4mcWDU5A0oWJTNGp3xQRbWDyHXAne NkemPljTmnWGdUj5dlybke3PwNcM78HgNAiapyNHkJu/5EjxuceHvvHxQe24rcsb7QH0EGbriNdc +9r9GMPOMBLpKKZXDR6rvrYct0ZoLyyMZV+MhSDEpQBQJ9k4THjt51qxhcfCV/4i+ejs9YM3cqUq xiu6TneNeV6rNq/uUFREWsK2JChyI/xyR+ZXgfxix/TtWHWxD8p5z3pNNdrIL9hOK3SQyxXXVVBQ Rh/gOF6zUFK65ll8UwrOQKrLk2E/VNlWjaL/Ixt7ToqRGqxwunaMEYZZ1VebHJfNV02WWPtzsFfo OZu+F5XirtD4z7wapB5fTqiMa9a2TIWMUmpY+8l0b/FuRh9lrEqJXHIgO3kvLFkkGWPZ09C4H6GW Vd2U+yzCyfWuRM/L194BpMl8oVMUKJnNLpCFCDxF3t1ftxsuCOpzXRSO1HFDi9/8PLnba5QlSePr zzhto8k27kwXRZDEAGVHkW445Gvq52QHNkUc71HR+kauUqRSq0xGfCudFHzPeWeUSVVB2hWIovpe L1VVeHQ5plnA5W7mip2oFHgRXLv29qWcVF2Rd9iQbzsMWZVx6+43LCONcJEnLIHjGmKbnUNGfABT AF82Y7E1ZY2V5/6PALonCvynHmh4j10QFWqMAN/q4mJEO0Fepy1I2JBLvoH8q2nd0HP+sIZ0vLeb cRFZjuC2uB0Aaq2ZPB9pYYoIN9Dzl3W9iEPnpmMEvCenIFqeuVyR9WG0hIfvICkHgIhOxv996qDi 6nuRgIjmzQcAC+Qlil/HTKxs3U/4ASXtFCHB0ox/tLkjiWpzDyyFuoeb50e4mOy87hf0LHj2bXTU 2tfKJYPkGHC4MDJngYvSGiGjgSweEwBYBj/wMh5cBhCcRR7B2R0gBDfQqt2Zr4aocBT+dg6fiz5F A4qkph9G4GAW6wascsrqMi0H6LjnmndXEOhFVXsiXxzKJlKTRUEU9dTnAwd0iyCdHBEUFr9Uki+5 M0AfDuMxyOTTgV26MX2Z2v3AZIGoQPGvkegiKWrUNcgiFYhvf80L532EeSUL2arWCWE+0IgstU3C kGebNQDQTIN+c6Z/vk+tDVDVAhJQ== From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 09/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_coex_enable Date: Sat, 22 Apr 2023 18:04:53 +0800 X-OQ-MSGID: <4948f7c2aca708649f1acccbce71dae00e18b2a7.1682156784.git.zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If there is a failure during copy_from_user, rtw_debugfs_set_coex_enable should return negative error code instead of a positive value count. Fix this bug by returning correct error code. Signed-off-by: Zhang Shurong --- 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 aef43f3ca364..f9bcb44b42ac 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -883,7 +883,9 @@ static ssize_t rtw_debugfs_set_coex_enable(struct file *filp, bool enable; 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, &enable); if (ret) { From patchwork Sat Apr 22 10:04:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F501C7618E for ; Sat, 22 Apr 2023 10:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbjDVKRM (ORCPT ); Sat, 22 Apr 2023 06:17:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjDVKRH (ORCPT ); Sat, 22 Apr 2023 06:17:07 -0400 Received: from out203-205-251-85.mail.qq.com (out203-205-251-85.mail.qq.com [203.205.251.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69071E70; Sat, 22 Apr 2023 03:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158320; bh=S1YnfUryk0L2ZsYdhjekcoTp3feYwxUkk3NnwN11E5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=z0zMRTcVXte0BGrwzwElt40Jtg/TF0YfxVEB7KytNXRJlVTRWWh4mC8LPAWhD/eUv RDxMcmfPI8cN8LNuknx3VSCn7FHOzPIMUe2Ee33Di6NN2l46/s+8ham6vuc39wxAW+ NJIjFEjoVwXbBcAkmg5Wziv1RlBJqifOHYnXZt2U= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0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20Gc5XExqsc/Bny9iFCfdy 528BABRkuwWI4QSyQv1ueRYj7zFZItJwQ3XSuYkX9uJx13MsLIJXLi7rRikexO0vNd8nLTlXZCy2 ETbQWJEL5wwcTLiBWLMjv/NkfmN8aiVBc1OnGAoNqJ5erPzIOe From: Zhang Shurong To: tony0620emma@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH 10/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_fw_crash Date: Sat, 22 Apr 2023 18:04:54 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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)