From patchwork Tue Jul 20 14:46:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 481523 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5225944jao; Tue, 20 Jul 2021 08:14:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGmgeKHPIt06dFXws8r7hr0F98OGaeTN7BECNtAj2lZOxtHjewGqKHvuHrFUP/fHb4qcNU X-Received: by 2002:a17:906:f6d5:: with SMTP id jo21mr33224101ejb.444.1626794051028; Tue, 20 Jul 2021 08:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626794051; cv=none; d=google.com; s=arc-20160816; b=WhI2uJM01ndAdiCiFm91SOhft/iTGbaeARj4EUviOXVvjSQ87dOJAC62JgJbUhcN3l usdMPiNMsrMh61ICoUycwb58tL7EOiSW+QQ5i7tV6m/0aZjv+wI/e6q0VqZANT5XJ7vT c00UluyTk5g3RzYp25frlJOS7RtDnM5K+k2uTAAmRTeiRpxp4lKo6Wscr1qw/E3Qxk3m n5EPdyQ+4DLzjHaYl5uPsEErDZj+xCcDS6cILgqD79dnZ952btMGPaulWwJptJeXfW4u aU27fl2uNkE41I0purlbjQl4XCRBXQHD2vmCTq1u+Lq44L2bgtGFyWzba+wtgSi9VjNg sI6g== 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=nE/kxvFjQilosi+Nsdydy6EVG5wWnPbncxZzJcsVRyk=; b=DQu4zPCrIQQ8woC86kUM98E96PJiQBMEnhxyhgSBg8UKoJ3W4Dszj216STEQntAgUE OCIeBQdK/iULD3RaM0q1w6oDMFIypPsnKpWUtpE4dOUqiWSVkBObmzAU8yZ/E7IqIHtz HW90pQKu+vZDZbFHHHnF9TqwBBQONNUTEe4n0JXKWm08MMC8xOJamrfffOLFNyUlLL8q G04Vo54s5Do4mGY/fYi1hkGZ8gtfql8LacW0tb3vTFyf+kKGekrYxu2WSOsia51ky5SG dWOcS58NVzJy92tWbJXy6qldi1eBczasWbgcrY0z670owBQTO45yUAI9PR7pFYtq9GEY DTJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bTMp40i0; 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 du14si15486756ejc.35.2021.07.20.08.14.10; Tue, 20 Jul 2021 08:14:11 -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=bTMp40i0; 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 S236263AbhGTOdK (ORCPT + 8 others); Tue, 20 Jul 2021 10:33:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:55424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239419AbhGTONr (ORCPT ); Tue, 20 Jul 2021 10:13:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD68461248; Tue, 20 Jul 2021 14:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626792426; bh=sCWScan1YM+efElA/8QC1aA+DiJUApS8hHSW+UJyHbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bTMp40i0h5537pdlTK3sM1ZkIMEONbJQltTOJwtU5thspznwDCkDxlKgOL3cZ9xlq VYI6PfzuQtg0vZBuThGzzq5TSTnh9umCwV4hOiHKe2/7/nI601K1gm9Ovp8KnB2c+O q7kEQugi8FiDYnoNoMHlX68tzAyq8kPMn07WYg5DjIT+ufCdI63DAKCv5nSY40/fJV Nnq6qWnvtl0UpcZHA7Kr/jkL5bbZjK5xRZ52izJShtUqFvQaQDT7tUc1yaZF41G51q V7ygkoQhg4venW7sk/pYJJIYSB6hdYKyyFbONA2EmP2TveuierYj5tkxcSA28XHkka nkEYfarRIoDcg== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: Christoph Hellwig , Arnd Bergmann Subject: [PATCH net-next v2 12/31] eql: use ndo_siocdevprivate Date: Tue, 20 Jul 2021 16:46:19 +0200 Message-Id: <20210720144638.2859828-13-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210720144638.2859828-1-arnd@kernel.org> References: <20210720144638.2859828-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 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) -- 2.29.2 diff --git a/drivers/net/eql.c b/drivers/net/eql.c index 74263f8efe1a..8ef34901c2d8 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c @@ -113,6 +113,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -131,7 +132,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 +172,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 +270,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; }