From patchwork Fri Nov 6 22:17:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 320863 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1674359ilc; Fri, 6 Nov 2020 14:18:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCncg13/gJ2Gj6U8X7pQY4O8vIRfqbT7HZJlipXkMU79v8FW8UXHUbUI5ShJCqwp4/+RKQ X-Received: by 2002:a50:ed96:: with SMTP id h22mr3885766edr.336.1604701100845; Fri, 06 Nov 2020 14:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604701100; cv=none; d=google.com; s=arc-20160816; b=CnSVVogX1lS84MxNRGFMEm89Z5/Y1S//xXnIMmz76d7E/nCnqoXb/c3sCTtPfXXCen qI7I9dmockEiNf5+xiz4xAA0gQM1wUdyL+KerIkYyCNeKQ3d1XPT2HBnfopv0G3/DWE4 ITieFgcicgYmdqqlFOJsDOGbBwUOto9vKQ1VpzG+y4GrQY8z4FKxIP0Z7DUVqgexIzkE fjTlWbrHA57aX1NEtmLhpzT7EXLqLjN+Bn546RSCDo60Of+h7P+TbDsKW3OY7INh5Xt9 jTOg+lFcOUmxgxINdyhF0kYldAI4UDkvzj4Tb0TPJLH39WMgvCVnlBOb77REOskOS0Yt maZQ== 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=yiddFD1OJ7tEKkvqXHYVNF87irC29gQ85dDPS3ZcY+U=; b=qv4XqcdxzHoSCQm3loHQlPjSnzf2UopAzlqQfYrj582m18QlL0Jib4nAhMdv7C2tCW CPKUiGgU71prOanTPPFZ/v7r1nTKrjHd1gnOWiYNrdQ+zJf8Rt+lQICHoVWL4/+9gXAB tqNcbY1EmObKjwTOF+h4BMltIoaxZMn7TEX/MylyFY8lcNoWZR08AcBfJsJsEgvlReEG sLyKHo3q1baQEy4eDrW345k960CmPzv+ndTDWbZ9sY7K0uuyweKulbuQb4Kg6/xidleE +P69jPhOiqUYqt34R9A08NKWpCoqlIxTpM8gIBEq6uw9iPAoXsVHfWa+5NOCI0UsHYrc z5Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lZjFdbVK; 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 ci4si1848008ejb.436.2020.11.06.14.18.20; Fri, 06 Nov 2020 14:18:20 -0800 (PST) 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=default header.b=lZjFdbVK; 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 S1728917AbgKFWSP (ORCPT + 8 others); Fri, 6 Nov 2020 17:18:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:41344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728887AbgKFWSH (ORCPT ); Fri, 6 Nov 2020 17:18:07 -0500 Received: from localhost.localdomain (HSI-KBW-46-223-126-90.hsi.kabel-badenwuerttemberg.de [46.223.126.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6656E20B1F; Fri, 6 Nov 2020 22:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604701085; bh=m0RjMsn6WwofvvE4NYY1pS3GxXmUo66/XIWhjld9ez8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lZjFdbVKp25Qrql+efzzWsBxMC4g7cW6WMF5FzNZXxrLxsGCulsVre9Ry02k9fFSi 5z1FSAfrv26byYbPUYzDCxhfGlOr0j/0sN3hH5d48y25AJj96u+XUtOzuoY5WRV71+ CX6vrZapw6I+N1D/39DJFi0LvQmJa55SRHnLlDic= From: Arnd Bergmann To: netdev@vger.kernel.org Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, bridge@lists.linux-foundation.org, linux-hams@vger.kernel.org, Jakub Kicinski , Christoph Hellwig , Alexander Viro , Johannes Berg , Andrew Lunn , Heiner Kallweit Subject: [RFC net-next 04/28] hostap: use ndo_siocdevprivate Date: Fri, 6 Nov 2020 23:17:19 +0100 Message-Id: <20201106221743.3271965-5-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201106221743.3271965-1-arnd@kernel.org> References: <20201106221743.3271965-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. 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.27.0 diff --git a/drivers/net/wireless/intersil/hostap/hostap.h b/drivers/net/wireless/intersil/hostap/hostap.h index c4b81ff7d7e4..0c41efa252f0 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 514c7b01dbf6..7b6471e44255 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c @@ -3952,7 +3952,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; @@ -3964,9 +3965,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); @@ -4020,11 +4018,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,