From mboxrd@z Thu Jan 1 00:00:00 1970 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 69E04C433F5 for ; Sat, 5 Feb 2022 11:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358243AbiBELiU (ORCPT ); Sat, 5 Feb 2022 06:38:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348103AbiBELh7 (ORCPT ); Sat, 5 Feb 2022 06:37:59 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFE97C061348 for ; Sat, 5 Feb 2022 03:37:58 -0800 (PST) Received: from dslb-188-104-059-100.188.104.pools.vodafone-ip.de ([188.104.59.100] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1nGJO6-0005c9-H4; Sat, 05 Feb 2022 12:37:54 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 8/8] staging: r8188eu: limit rf register writes to path a Date: Sat, 5 Feb 2022 12:37:41 +0100 Message-Id: <20220205113741.379070-9-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220205113741.379070-1-martin@kaiser.cx> References: <20220205113741.379070-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The r8188eu driver uses only RF_PATH_A. At the moment, the only exception are private ioctls. It does not make sense if these ioctls set registers that are not used anywhere else in the driver. This patch limits the private ioctl 0x0C, i.e. the rtw_wx_write_rf function, to RF_PATH_A. For any other setting, we return an error saying the parameter is invalid. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index c54ec5602ddf..c41d75666568 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -2083,6 +2083,9 @@ static int rtw_wx_write_rf(struct net_device *dev, u32 path, addr, data32; path = *(u32 *)extra; + if (path != RF_PATH_A) + return -EINVAL; + addr = *((u32 *)extra + 1); data32 = *((u32 *)extra + 2); rtl8188e_PHY_SetRFReg(padapter, path, addr, 0xFFFFF, data32); -- 2.30.2