From patchwork Fri Nov 6 22:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 320883 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1675986ilc; Fri, 6 Nov 2020 14:21:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLdMTTRTxF/zS2egttaHTjOG1sf9n2AIwaFJiiGJzzrQbTA5PY7Qna9Ni5mDmxZrInitp1 X-Received: by 2002:a17:906:3fc5:: with SMTP id k5mr4330864ejj.158.1604701274884; Fri, 06 Nov 2020 14:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604701274; cv=none; d=google.com; s=arc-20160816; b=NoWCng2KKyXBdCIPcOpPTZKA6zwg9aZCaE67KxmfrLyyIGsmykZljb/p8OfsBF+R+K Ar5WXraeiZDO+c+bYCV2mwRjq6jICQ7VPcytTnreRyZQwdGZekaCnVAS1KrAC7hjodRi CqsOFrEozGybV8EqoxWjBo5KgNYXqN44rqb0ACM/4ssS8JrvjFolGlnV1fqPGuqaRid6 QK0wDNUvaUnmjO/rn7Dy52zQb7fB+cxCWfJWPO4Wl334qGXGLdK+GF45/8oOkX9IPU8w 3sbdV7WdHJP0tvnoL4F62xOiBxDpEbqqqbBqfp7WJ8Id7W5b/YcckRRLodQ6DLT9qsTG /qUg== 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=qZLdW8GOWNKjEyj3urm8wcPisrGoMoqKdxFIKQBwNMA=; b=JJdVA39Gk9ljudH0KSskqQDJwA1Dbx5MB/sAOd4Lkvm0hET6Yvgai8pErytBDczmll UsV3zpi4eBDaPVsSCh7bfpuCt6eM3g8UbJMDHJeKe6hYO/r+LjOaFA9PfwYY4sAxubTX mBRp3najNvqxrpj8En+Y1AiEzDKIrltmLjxmwBniZMIcASObbuIAMdp19eNYmpnVW+pE x9dP1+PoEpNCbxxWWOpVIKqnXRvmHpXfBWeAGqBwNY/o5RF105ZJB/yv7AuMD73K4hqZ jwUskGjEqYW4L6kn8GTG/vNfbH0s9l5wssX0Tez1G5aGmDkiU9EsNFmGlA6+UuaxGFJH nRGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QM+rUOnI; 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 e14si2223916edl.270.2020.11.06.14.21.14; Fri, 06 Nov 2020 14:21:14 -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=QM+rUOnI; 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 S1729034AbgKFWSf (ORCPT + 8 others); Fri, 6 Nov 2020 17:18:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:41902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728684AbgKFWSd (ORCPT ); Fri, 6 Nov 2020 17:18:33 -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 72A34206C1; Fri, 6 Nov 2020 22:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604701111; bh=eiNHnuy+hNjbjFU7Amv3yBUD8VshOljAcCBAICoPPSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QM+rUOnImvpXUQa8m9VB331eo9iLMl5iqRtNhQJjHILlDnEv1nX0Fmtaj+kGqYk+1 XoiuTrhJCwNJUaprjY8D6HOvRTfhJOzz32m6+ApMK8RF4XsVRMeh9qCykF6VMAy8hT nPAAZ9VJlTyX6MBlOZy0PkW3bhUBZhsmB2XUEeWY= 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 13/28] eql: use ndo_siocdevprivate Date: Fri, 6 Nov 2020 23:17:28 +0100 Message-Id: <20201106221743.3271965-14-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 The private ioctls in eql pass the arguments correctly through ifr_data, but the slaving_request_t and slave_config_t structures are incompatible with compat mode and need special conversion code in the driver. Convert to siocdevprivate for now, and return an error when called in compat mode. Signed-off-by: Arnd Bergmann --- drivers/net/eql.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) -- 2.27.0 diff --git a/drivers/net/eql.c b/drivers/net/eql.c index 74263f8efe1a..b8707559a0f5 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c @@ -131,7 +131,8 @@ static int eql_open(struct net_device *dev); static int eql_close(struct net_device *dev); -static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); +static int eql_siocdevprivate(struct net_device *dev, struct ifreq *ifr, + void __user *data, int cmd); static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev); #define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) @@ -170,7 +171,7 @@ static const char version[] __initconst = static const struct net_device_ops eql_netdev_ops = { .ndo_open = eql_open, .ndo_stop = eql_close, - .ndo_do_ioctl = eql_ioctl, + .ndo_siocdevprivate = eql_siocdevprivate, .ndo_start_xmit = eql_slave_xmit, }; @@ -268,25 +269,29 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *sc); static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mc); static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mc); -static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +static int eql_siocdevprivate(struct net_device *dev, struct ifreq *ifr, + void __user *data, int cmd) { if (cmd != EQL_GETMASTRCFG && cmd != EQL_GETSLAVECFG && !capable(CAP_NET_ADMIN)) return -EPERM; + if (in_compat_syscall()) /* to be implemented */ + return -EOPNOTSUPP; + switch (cmd) { case EQL_ENSLAVE: - return eql_enslave(dev, ifr->ifr_data); + return eql_enslave(dev, data); case EQL_EMANCIPATE: - return eql_emancipate(dev, ifr->ifr_data); + return eql_emancipate(dev, data); case EQL_GETSLAVECFG: - return eql_g_slave_cfg(dev, ifr->ifr_data); + return eql_g_slave_cfg(dev, data); case EQL_SETSLAVECFG: - return eql_s_slave_cfg(dev, ifr->ifr_data); + return eql_s_slave_cfg(dev, data); case EQL_GETMASTRCFG: - return eql_g_master_cfg(dev, ifr->ifr_data); + return eql_g_master_cfg(dev, data); case EQL_SETMASTRCFG: - return eql_s_master_cfg(dev, ifr->ifr_data); + return eql_s_master_cfg(dev, data); default: return -EOPNOTSUPP; }