From patchwork Tue Jul 27 13:44:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 486700 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp231671jas; Tue, 27 Jul 2021 06:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8Q5l0LpY6Bcib+W4NgbdAYiFaf4NzPYZ3ln0uak/6s8tkwTOb9KT7cZf04FRBED1t0prC X-Received: by 2002:a05:6402:31a4:: with SMTP id dj4mr16384416edb.350.1627393574738; Tue, 27 Jul 2021 06:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627393574; cv=none; d=google.com; s=arc-20160816; b=Jk3TrURqv4XLAF0AtWjj1ttJV1ak5rMSaJLSv7to+CZr0JIGYhhKru/KgoJjUw6iQQ 5hgJIFZ0RHpMmRiB/KYgszBH9yK/fFBv8vkuXMbdajgWp5YvVNdisbhanqaFdhxCvBTk FuZnOTVD7Jw3Jb0/yup8c5TSJS+dFSIXsRN5QxwjdEXDgwhhhVxoacX4nczAPBElLfK2 FVYlMGZv+9YF4axzUesG0Ykv8R8CqfYv6BUPVPOA1AaAynV47ipmpxI60pwHKuW3gqv0 fgLDcErV3mQgsCph5+Bp28jq2KHeImT/262zoUKQkoBUFn2Uny6DBJXq7YNmO9HT7Y1A kSeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C7AqE9/tNfRQp5obi/DM2Z+KMUzyOEODaRYei/V5faQ=; b=M7VCgguW/Bs7nHVQJmT/NZvFZYzAvExwRZ5aYk/yiPyMdYo012bpjcN2xj82FvyUgW Y2JsmzUQTNaMXy450bdzdtXSqb2SFHOXcvOidTa9ogMCTIwVk83/ccRexL222GOp2AVL 7C2tlnhfvFY/Cxmgeidp7rxaY7IeFDeBoJDJ8k33YNWbaKA3t8uI6bPm8luG7T35B4r4 17V3Ibmo+PzA7sZvo3vSZuhBt/zanY5LFVivK/M5DHp1oDnb+YRqvoRfLuLmeF1Rb+Fy ZwQ9RVf0Kuh2LiNWHSCm2y+UM5FqXOHuEIWTpZqGE0ERj91y9oc93GK9TQjUOk83Z+Ma sUUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jYvuG5wu; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o20si2939200ejm.682.2021.07.27.06.46.14; Tue, 27 Jul 2021 06:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jYvuG5wu; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236746AbhG0NqL (ORCPT + 8 others); Tue, 27 Jul 2021 09:46:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:46198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236737AbhG0NqG (ORCPT ); Tue, 27 Jul 2021 09:46:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26C57619F5; Tue, 27 Jul 2021 13:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627393566; bh=SZsjM23mBtygU13MBhdelbDpg55lCSZeyKVhma7gvRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jYvuG5wuBgCk/0r0GCNILmRA1QbCmZzrn6iunSxwY76HSJqC0dEE/rXUK31wb4BGZ W4ec6pyXnuIHahqc3oBkABYGae08isss7PW0Wq4zgM1S+GgK9Y1Kps5GsQXihcdfTn QGKP5pdM65fOJ1H6HHM2ZMOuhv9B0Dr6wmA6iZ7i1qv0e2x7yZtdQHVqfgTi84OBhS c/RMSsJU/3pX1BKyDnnpVza/SuvKGropERmR97+amXSLASVz70BRneIPpOTS1kDpnu d6e7xBIfWQ/Nr5TS/dqJ7jWuq12BeTrawnrfWizOYjvT6UyTZT/jY6KaFh1UZTlUqw wYB1nyDOwaVJw== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Arnd Bergmann , Jouni Malinen , Kalle Valo Subject: [PATCH net-next v3 04/31] hostap: use ndo_siocdevprivate Date: Tue, 27 Jul 2021 15:44:50 +0200 Message-Id: <20210727134517.1384504-5-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210727134517.1384504-1-arnd@kernel.org> References: <20210727134517.1384504-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann hostap has a combination of iwpriv ioctls that do not work at all, and two SIOCDEVPRIVATE commands that work natively but lack a compat conversion handler. For the moment, move them over to the new ndo_siocdevprivate interface and return an error for compat mode. Cc: Jouni Malinen Cc: Kalle Valo Signed-off-by: Arnd Bergmann --- drivers/net/wireless/intersil/hostap/hostap.h | 3 +- .../wireless/intersil/hostap/hostap_ioctl.c | 30 +++++++++++++++---- .../wireless/intersil/hostap/hostap_main.c | 3 ++ 3 files changed, 29 insertions(+), 7 deletions(-) -- 2.29.2 Acked-by: Kalle Valo diff --git a/drivers/net/wireless/intersil/hostap/hostap.h b/drivers/net/wireless/intersil/hostap/hostap.h index c4b81ff7d7e4..c17ab6dbbb53 100644 --- a/drivers/net/wireless/intersil/hostap/hostap.h +++ b/drivers/net/wireless/intersil/hostap/hostap.h @@ -93,6 +93,7 @@ extern const struct iw_handler_def hostap_iw_handler_def; extern const struct ethtool_ops prism2_ethtool_ops; int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); - +int hostap_siocdevprivate(struct net_device *dev, struct ifreq *ifr, + void __user *data, int cmd); #endif /* HOSTAP_H */ diff --git a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c index 49766b285230..0a376f112db9 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c @@ -3941,7 +3941,8 @@ const struct iw_handler_def hostap_iw_handler_def = .get_wireless_stats = hostap_get_wireless_stats, }; - +/* Private ioctls (iwpriv) that have not yet been converted + * into new wireless extensions API */ int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct iwreq *wrq = (struct iwreq *) ifr; @@ -3953,9 +3954,6 @@ int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) local = iface->local; switch (cmd) { - /* Private ioctls (iwpriv) that have not yet been converted - * into new wireless extensions API */ - case PRISM2_IOCTL_INQUIRE: if (!capable(CAP_NET_ADMIN)) ret = -EPERM; else ret = prism2_ioctl_priv_inquire(dev, (int *) wrq->u.name); @@ -4009,11 +4007,31 @@ int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) wrq->u.ap_addr.sa_data); break; #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ + default: + ret = -EOPNOTSUPP; + break; + } + + return ret; +} +/* Private ioctls that are not used with iwpriv; + * in SIOCDEVPRIVATE range */ +int hostap_siocdevprivate(struct net_device *dev, struct ifreq *ifr, + void __user *data, int cmd) +{ + struct iwreq *wrq = (struct iwreq *)ifr; + struct hostap_interface *iface; + local_info_t *local; + int ret = 0; - /* Private ioctls that are not used with iwpriv; - * in SIOCDEVPRIVATE range */ + iface = netdev_priv(dev); + local = iface->local; + + if (in_compat_syscall()) /* not implemented yet */ + return -EOPNOTSUPP; + switch (cmd) { #ifdef PRISM2_DOWNLOAD_SUPPORT case PRISM2_IOCTL_DOWNLOAD: if (!capable(CAP_NET_ADMIN)) ret = -EPERM; diff --git a/drivers/net/wireless/intersil/hostap/hostap_main.c b/drivers/net/wireless/intersil/hostap/hostap_main.c index de97b3304115..54f67b682b6a 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_main.c +++ b/drivers/net/wireless/intersil/hostap/hostap_main.c @@ -797,6 +797,7 @@ static const struct net_device_ops hostap_netdev_ops = { .ndo_open = prism2_open, .ndo_stop = prism2_close, .ndo_do_ioctl = hostap_ioctl, + .ndo_siocdevprivate = hostap_siocdevprivate, .ndo_set_mac_address = prism2_set_mac_address, .ndo_set_rx_mode = hostap_set_multicast_list, .ndo_tx_timeout = prism2_tx_timeout, @@ -809,6 +810,7 @@ static const struct net_device_ops hostap_mgmt_netdev_ops = { .ndo_open = prism2_open, .ndo_stop = prism2_close, .ndo_do_ioctl = hostap_ioctl, + .ndo_siocdevprivate = hostap_siocdevprivate, .ndo_set_mac_address = prism2_set_mac_address, .ndo_set_rx_mode = hostap_set_multicast_list, .ndo_tx_timeout = prism2_tx_timeout, @@ -821,6 +823,7 @@ static const struct net_device_ops hostap_master_ops = { .ndo_open = prism2_open, .ndo_stop = prism2_close, .ndo_do_ioctl = hostap_ioctl, + .ndo_siocdevprivate = hostap_siocdevprivate, .ndo_set_mac_address = prism2_set_mac_address, .ndo_set_rx_mode = hostap_set_multicast_list, .ndo_tx_timeout = prism2_tx_timeout,